1

The method I want to patch is something like this:

[Serializable]
public class Class1 : IEnumerable<Class2>, IEnumerable
{
    private void Method()
    {//...
    }
}

I tried

[HarmonyPostfix,HarmonyPatch(typeof(Class1), "Method")]
public static IEnumerator postPatch(Class1 __instance,IEnumerator result)
{
    //...
    yield return result;
}

but it got

HarmonyLib.HarmonyException: IL Compile Error (unknown location) ---> HarmonyLib.HarmonyException: IL Compile Error (unknown location) ---> System.InvalidProgramException: Invalid IL code in (wrapper dynamic-method) Class1:DMDClass1::Method (Class1): IL_0311: ret

when load the moudle

Markus
  • 20,838
  • 4
  • 31
  • 55
Daedra
  • 111
  • 1

0 Answers0