Skip to content

DetourRuntimeNETPlatform.GetFunctionPointer() caught in infinite loop  #34

@LaserHydra

Description

@LaserHydra

I am trying to use Harmony to apply some patches, however it seems to be getting stuck in an infinite loop while attempting to get the function pointer for the original method.

I have not been able to debug it more accurately yet, but it is seems to be getting stuck while executing this call:


And it seems to keeps running into this jump:

Interestingly, the issue did not occur when I manually patched the DLL, adding the patches and invoking the patch process from the original DLL. I have since moved the patches and harmony to my own DLL to which I have only injected a single call from the original DLL. However since I have done that, this issue has seemed to occur every time.

Stack trace

   at MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform.GetNativeStart(MethodBase method)
   at MonoMod.RuntimeDetour.Platforms.DetourRuntimeNETPlatform.NotThePreStub(IntPtr ptrGot, IntPtr ptrParsed, Boolean& wasPreStub)
   at MonoMod.RuntimeDetour.Platforms.DetourRuntimeNETPlatform.GetFunctionPointer(MethodBase method, RuntimeMethodHandle handle)
   at MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform.GetNativeStart(MethodBase method)
   at HarmonyLib.Memory.GetMethodStart(MethodBase method, Exception& exception)
   at HarmonyLib.Memory.DetourMethod(MethodBase original, MethodBase replacement)
   at HarmonyLib.Memory.DetourMethodAndPersist(MethodBase original, MethodBase replacement)
   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)

Further information

The DLL I am trying to patch is using .NET Framework v4.0, my DLL as well as the Harmony DLL I am using are .NET Framework v4.8.


Please let me know about any other information I can provide
Thank you for maintaining a great project 💯

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