pardeike / Harmony

A library for patching, replacing and decorating .NET and Mono methods during runtime
https://www.patreon.com/pardeike
MIT License
5.15k stars 485 forks source link

'CORINFO_METHOD_INFO' from assembly 'System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. #610

Closed shiguangwangyu closed 3 months ago

shiguangwangyu commented 3 months ago

Describe the bug I encountered this issue while injecting the program. How to fix the Net7.0 framework used in the target program? I also tried to disable JIT, but I still made a mistake

System.TypeLoadException: Could not load type 'CORINFO_METHOD_INFO' from assembly 'System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

pardeike commented 3 months ago

There was a discussion on the official Harmony discord not too long ago: https://discord.com/channels/131466550938042369/674571535570305060/1220681969101312020 and it seems that it chooses the wrong type at runtime. Nothing Harmony can fix for you.

gitlsl commented 3 months ago

System.TypeLoadException:“Could not load type 'CORINFO_METHOD_INFO' from assembly 'System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.”

I use .net8 also have this issue @pardeike

0Harmony.dll!HarmonyLib.PatchFunctions.UpdateWrapper(System.Reflection.MethodBase original, HarmonyLib.PatchInfo patchInfo) 0Harmony.dll!HarmonyLib.PatchProcessor.Patch() 0Harmony.dll!HarmonyLib.Harmony.Patch(System.Reflection.MethodBase original, HarmonyLib.HarmonyMethod prefix, HarmonyLib.HarmonyMethod postfix, HarmonyLib.HarmonyMethod transpiler, HarmonyLib.HarmonyMethod finalizer)

Aragas commented 3 months ago

System.TypeLoadException:“Could not load type 'CORINFO_METHOD_INFO' from assembly 'System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.”

I use .net8 also have this issue @pardeike

0Harmony.dll!HarmonyLib.PatchFunctions.UpdateWrapper(System.Reflection.MethodBase original, HarmonyLib.PatchInfo patchInfo) 0Harmony.dll!HarmonyLib.PatchProcessor.Patch() 0Harmony.dll!HarmonyLib.Harmony.Patch(System.Reflection.MethodBase original, HarmonyLib.HarmonyMethod prefix, HarmonyLib.HarmonyMethod postfix, HarmonyLib.HarmonyMethod transpiler, HarmonyLib.HarmonyMethod finalizer)

What's the version of Harmony used?

gitlsl commented 3 months ago

@Aragas Harmony 2.3.3 .net8 windows , it seem when I switch to Harmony 2.3.3.Thin, now work as except