Skip to content

Conversation

@ksqeib
Copy link

@ksqeib ksqeib commented Jan 29, 2026

I apologize for submitting incomplete work, as I am unable to address issues arising from the results of the work that has already been completed.

I have run the build.sh script and tested it with patchTarget values of p and m, which worked fine. However, when the patchTarget value is t, there is an issue as follows

OTAPI.Server.Launcher Arch: X64
[OTAPI] Starting up (TML PC Server,1.4.3.6+2022.07,ModFw:1.1.15+a2c0c70).
[ModFw:Runtime] Loading ClearScript interface
[JS] Loading ClearScript files from ./clearscript
[JS] Loading clearscript\test.js
[JS] Load failed
Microsoft.ClearScript.ScriptEngineException: Error: Access is denied: 'Terraria.Main+MouseTextCache'.
 ---> Microsoft.ClearScript.ScriptEngineException: Error: Access is denied: 'Terraria.Main+MouseTextCache'.
 ---> System.TypeLoadException: Access is denied: 'Terraria.Main+MouseTextCache'.
   at System.RuntimeTypeHandle.GetRuntimeTypeFromHandleSlow(IntPtr handle)
   at System.RuntimeTypeHandle.GetDeclaringType(RuntimeType type)
   at System.RuntimeType.RuntimeTypeCache.GetEnclosingType()
   at System.Type.get_IsNested()
   at Microsoft.ClearScript.Util.TypeHelpers.IsImportable(Type type, IHostContext context)
   at Microsoft.ClearScript.HostTypeCollection.<>c.<AddAssembly>b__7_0(Type type)
   at System.Linq.Enumerable.IEnumerableWhereIterator`1.MoveNext()
   at Microsoft.ClearScript.Util.EnumerableHelpers.ForEach[T](IEnumerable`1 source, Action`1 action)
   at Microsoft.ClearScript.HostTypeCollection.AddAssembly(Assembly assembly)
   at Microsoft.ClearScript.HostTypeCollection.AddAssembly(String assemblyName)
   at System.Array.ForEach[T](T[] array, Action`1 action)
   at Microsoft.ClearScript.HostTypeCollection..ctor(String[] assemblyNames)
   at ModFramework.Modules.ClearScript.ModuleResolver.LoadDocumentAsync(DocumentSettings settings, Nullable`1 sourceInfo, String specifier, DocumentCategory category, DocumentContextCallback contextCallback)
   at Microsoft.ClearScript.DocumentLoader.LoadDocument(DocumentSettings settings, Nullable`1 sourceInfo, String specifier, DocumentCategory category, DocumentContextCallback contextCallback)
   at Microsoft.ClearScript.DocumentSettings.LoadDocument(Nullable`1 sourceInfo, String specifier, DocumentCategory category, DocumentContextCallback contextCallback)
   at Microsoft.ClearScript.V8.V8ProxyHelpers.LoadModule(IntPtr pSourceDocumentInfo, String specifier, UniqueDocumentInfo& documentInfo, Object& exports)
   at Microsoft.ClearScript.V8.SplitProxy.V8SplitProxyManaged.LoadModule(IntPtr pSourceDocumentInfo, Ptr pSpecifier, Ptr pResourceName, Ptr pSourceMapUrl, UInt64& uniqueId, DocumentKind& documentKind, Ptr pCode, IntPtr& pDocumentInfo, Ptr pExports)
   --- End of inner exception stack trace ---
   at Microsoft.ClearScript.V8.SplitProxy.V8SplitProxyNative.ThrowScheduledException()
   at Microsoft.ClearScript.V8.SplitProxy.V8SplitProxyNative.Invoke[T](Func`2 func)
   at Microsoft.ClearScript.V8.SplitProxy.V8ContextProxyImpl.Execute(UniqueDocumentInfo documentInfo, String code, Boolean evaluate)
   at Microsoft.ClearScript.V8.V8ScriptEngine.ExecuteRaw(UniqueDocumentInfo documentInfo, String code, Boolean evaluate)
   at Microsoft.ClearScript.V8.V8ScriptEngine.ExecuteInternal(UniqueDocumentInfo documentInfo, String code, Boolean evaluate)
   at Microsoft.ClearScript.V8.V8ScriptEngine.<>c__DisplayClass130_0.<Execute>b__0()
   at Microsoft.ClearScript.ScriptEngine.ScriptInvokeInternal[T](Func`1 func)
   at Microsoft.ClearScript.V8.V8ScriptEngine.<>c__DisplayClass137_0`1.<ScriptInvoke>b__0()
   at Microsoft.ClearScript.V8.SplitProxy.V8SplitProxyManaged.InvokeHostAction(IntPtr pAction)
   --- Script error details follow ---
   Error: Access is denied: 'Terraria.Main+MouseTextCache'.
       at <anonymous>:0:0
   --- End of inner exception stack trace ---
   at Microsoft.ClearScript.V8.SplitProxy.V8SplitProxyNative.ThrowScheduledException()
   at Microsoft.ClearScript.V8.SplitProxy.V8SplitProxyNative.Invoke(Action`1 action)
   at Microsoft.ClearScript.V8.SplitProxy.V8ContextProxyImpl.InvokeWithLock(Action action)
   at Microsoft.ClearScript.V8.V8ScriptEngine.ScriptInvoke[T](Func`1 func)
   at Microsoft.ClearScript.V8.V8ScriptEngine.Execute(UniqueDocumentInfo documentInfo, String code, Boolean evaluate)
   at Microsoft.ClearScript.ScriptEngine.Evaluate(UniqueDocumentInfo documentInfo, String code, Boolean marshalResult)
   at Microsoft.ClearScript.ScriptEngine.Evaluate(DocumentInfo documentInfo, String code)
   at ModFramework.Modules.ClearScript.JSScript.Load()
   --- Script error details follow ---
   Error: Access is denied: 'Terraria.Main+MouseTextCache'.
       at <anonymous>:0:0
[ModFw:Runtime] Loading CSharp script interface
[CSharp] Loading module: example
[ModFw:Runtime] Loading Launcher Script!
[LauncherScript] Hello World! from a script
[CS] Loading CSharp scripts from ./csharp/plugins/scripts
[ModFw:Runtime] Loading Lua script interface
[LUA] Loading Lua scripts from ./lua
[LUA] Loading lua\test.lua
[LUA] Hello server from lua
[ModFw:Runtime] Loading Runtime Example!
[RuntimeExample Server] Hello World! from a compiled DLL
Unhandled exception. System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at MonoMod.Utils.DynamicMethodDefinition.<>c__DisplayClass3_0.<_CopyMethodToDefinition>g__ResolveTokenAs|1(Int32 token, TokenResolutionMode resolveMode)
   at MonoMod.Utils.DynamicMethodDefinition.<>c__DisplayClass3_0.<_CopyMethodToDefinition>g__ReadOperand|0(BinaryReader reader, Instruction instr)
   at MonoMod.Utils.DynamicMethodDefinition._CopyMethodToDefinition(MethodBase from, MethodDefinition into)
   at MonoMod.Utils.DynamicMethodDefinition.LoadFromMethod(MethodBase orig, ModuleDefinition& Module, MethodDefinition& def)
   at MonoMod.Utils.DynamicMethodDefinition..ctor(MethodBase method)
   at MonoMod.RuntimeDetour.DetourManager.RootManagedChainNode.PrepareDetour(IDetourFactory factory, MethodInfo& sourceClone, DynamicMethodDefinition& sourceCloneIl)
   at MonoMod.RuntimeDetour.DetourManager.ManagedDetourState.PrepareEndOfChain(IDetourFactory factory)
   at MonoMod.RuntimeDetour.DetourManager.ManagedDetourState.AddDetour(SingleManagedDetourState detour, Boolean takeLock)
   at MonoMod.RuntimeDetour.Hook.Apply()
   at MonoMod.RuntimeDetour.Hook..ctor(MethodBase source, MethodInfo target, Object targetObject, IDetourFactory factory, DetourConfig config, Boolean applyByDefault)
   at MonoMod.RuntimeDetour.Hook..ctor(MethodBase source, Delegate target, IDetourFactory factory, DetourConfig config, Boolean applyByDefault)
   at MonoMod.RuntimeDetour.Hook..ctor(MethodBase source, Delegate target, DetourConfig config, Boolean applyByDefault)
   at MonoMod.RuntimeDetour.Hook..ctor(MethodBase source, Delegate target, DetourConfig config)
   at MonoMod.RuntimeDetour.Hook..ctor(MethodBase source, Delegate target)
   at MonoMod.RuntimeDetour.HookGen.HookEndpointManager.Add(MethodBase method, Delegate hookDelegate)
   at MonoMod.RuntimeDetour.HookGen.HookEndpointManager.Add[T](MethodBase method, Delegate hookDelegate)
   at On.Terraria.Main.add_ctor(hook_ctor)
   at Program.<<Main>$>g__Program_OnLaunched|0_5(Object sender, EventArgs e) in D:\self\tr\Open-Terraria-API\OTAPI.Server.Launcher\Program.cs:line 157
   at Terraria.Program.mfwh_LaunchOTAPI()
   at Terraria.Program.LaunchOTAPI()
   at Terraria.Program.mfwh_LaunchGame_(Boolean isServer)
   at Terraria.Program.LaunchGame_(Boolean isServer)
   at Terraria.Program.mfwh_LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at MonoLaunch.<>c__DisplayClass1_0.<Main>b__0()
   at System.Threading.Thread.StartCallback()

Happy New Year to the OTAPI team! Apologies for the ping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants