Godot 4.2.1中Harmony 2.3.3编辑器正常但导出构建失效求助
Godot 4.2.1 中 Harmony 2.3.3 导出构建后补丁失败问题
我在Godot 4.2.1中使用Harmony 2.3.3,编辑器内可以正常给方法打前缀补丁,但导出构建后补丁失败,抛出如下异常:
System.ArgumentException: GenericArguments[0], 'MonoMod.Utils.Cil.CecilILGenerator', on 'MonoMod.Utils.Cil.ILGeneratorProxy[TTarget]' violates the constraint of type 'TTarget'. ---> System.TypeLoadException: GenericArguments[0], 'MonoMod.Utils.Cil.CecilILGenerator', on 'MonoMod.Utils.Cil.ILGeneratorProxy[TTarget]' violates the constraint of type parameter 'TTarget'. at System.RuntimeTypeHandle.Instantiate(RuntimeType inst) at System.RuntimeType.MakeGenericType(Type[] instantiation) --- End of inner exception stack trace --- at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e) at System.RuntimeType.MakeGenericType(Type[] instantiation) at MonoMod.Utils.Cil.ILGeneratorShim.GetProxy() at MonoMod.Utils.DynamicMethodDefinition.GetILGenerator() 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 HarmonyLib.Harmony.Patch(MethodBase original, HarmonyMethod prefix, HarmonyMethod postfix, HarmonyMethod transpiler, HarmonyMethod finalizer) at HarmonyTester.Test() in G:\Godot Projects\HarmonyExportIssue\HarmonyTesting\HarmonyTester.cs:line 24
这看起来是依赖问题,我参考过Harmony GitHub上的相关议题,但不知道后续该如何解决。我已准备好最小复现示例(基于Godot 4.2.1-mono)和对应的示例构建版本。
内容的提问来源于stack exchange,提问作者Awarets
相关产品推荐
相关产品推荐

