Skip to content

Failed to create proxy when inside an AssemblyLoadContext in net6 #26

@cc004

Description

@cc004

stacktrace

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.IO.FileLoadException: Could not load file or assembly 'MonoMod.Common, Version=22.3.5.1, Culture=neutral, PublicKeyToken=null'. Operation is not supported. (0x80131515)
File name: 'MonoMod.Common, Version=22.3.5.1, Culture=neutral, PublicKeyToken=null'
 ---> System.NotSupportedException: Resolving to a collectible assembly is not supported.
   at System.Reflection.RuntimeAssembly.GetType(QCallAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive, ObjectHandleOnStack assemblyLoadContext)
   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
   at System.Reflection.Assembly.GetType(String name)
   at MonoMod.Utils.Cil.ILGeneratorShim.ILGeneratorBuilder.GenerateProxy()
   at MonoMod.Utils.Cil.ILGeneratorShim.GetProxy()
   at HarmonyLib.MethodPatcher..ctor(MethodBase original, MethodBase source, List`1 prefixes, List`1 postfixes, List`1 transpilers, List`1 finalizers, Boolean debug)
   at HarmonyLib.PatchFunctions.UpdateWrapper(MethodBase original, PatchInfo patchInfo)
   at HarmonyLib.PatchProcessor.Patch()
   at Localizer.Utils.Patch(Harmony instance, String class, String method, Boolean exactMatch, HarmonyMethod prefix, HarmonyMethod postfix, HarmonyMethod transpiler) in Localizer\Helpers\Utils.cs:line 426
   at Localizer.Localizer..ctor() in Localizer.cs:line 59
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
   at Terraria.ModLoader.Core.AssemblyManager.Instantiate(ModLoadContext mod) in tModLoader\Terraria\ModLoader\Core\AssemblyManager.cs:line 188
   at Terraria.ModLoader.Core.AssemblyManager.<>c__DisplayClass11_0.<InstantiateMods>b__1(ModLoadContext mod) in tModLoader\Terraria\ModLoader\Core\AssemblyManager.cs:line 260
   at System.Linq.Enumerable.SelectListIterator`2.ToList()
   at Terraria.ModLoader.Core.AssemblyManager.InstantiateMods(List`1 modsToLoad, CancellationToken token) in tModLoader\Terraria\ModLoader\Core\AssemblyManager.cs:line 258
   at Terraria.ModLoader.Core.ModOrganizer.LoadMods(CancellationToken token) in tModLoader\Terraria\ModLoader\Core\ModOrganizer.cs:line 243
   at Terraria.ModLoader.ModLoader.Load(CancellationToken token) in tModLoader\Terraria\ModLoader\ModLoader.cs:line 116

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions