Describe the bug
Trying to patch a method which ends in a throw results in an exception on the latest pre-release version. The specific method and exception are described below.
To Reproduce
I'm not sure what the exact problem is but trying to patch RimWorld's RimWorld.Bill_Production.ShouldDoNow with a postfix (can be an empty one) now results in an exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->
System.InvalidProgramException: Invalid IL code in (wrapper dynamic-method)
MonoMod.Utils.DynamicMethodDefinition:RimWorld.Bill_Production.ShouldDoNow_Patch1 (RimWorld.Bill_Production): IL_00ec: shr.un
The method's body is a chain of ifs and early returns ending with a throw.
The method is postfixed with Test.Test::Postfix. I guess that the problem is that the replacement doesn't end in a ret which is likely caused by 606ba09.
Expected behavior
I expect the method to get patched without an exception.
Runtime environment (please complete the following information):
Describe the bug Trying to patch a method which ends in a throw results in an exception on the latest pre-release version. The specific method and exception are described below.
To Reproduce I'm not sure what the exact problem is but trying to patch RimWorld's
RimWorld.Bill_Production.ShouldDoNow
with a postfix (can be an empty one) now results in an exception:The method's body is a chain of
if
s and early returns ending with athrow
.The replacement IL from the Harmony log:
The method is postfixed with
Test.Test::Postfix
. I guess that the problem is that the replacement doesn't end in aret
which is likely caused by 606ba09.Expected behavior I expect the method to get patched without an exception.
Runtime environment (please complete the following information):