You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cooked it down to a minimal case without Harmony or dynamic methods:
Example
// tested on Win 64bit, .NET 4.7.2// but Harmony tests fail on different combinationsusingMonoMod.Core;usingSystem;usingSystem.Reflection;classProgram{staticvoidMain(){varoriginal=typeof(SomeClass).GetMethod(nameof(SomeClass.Test),BindingFlags.Public|BindingFlags.Instance)??thrownewNullReferenceException();varreplacement=typeof(SomeClass).GetMethod(nameof(SomeClass.Replacement),BindingFlags.Public|BindingFlags.Static)??thrownewNullReferenceException();Console.WriteLine($"Methods {original}{replacement}");DetourFactory.Current.CreateDetour(original,replacement);varinstance=newSomeClass();instance.Test();Console.WriteLine("Done");}}publicclassSomeClass{publicstaticbool?Replacement(SomeClassinstance){_=instance;Console.WriteLine("Replacement");returntrue;}publicbool?Test(){Console.WriteLine("Test2");returnfalse;}// comment out this to avoid the errorpublicstrings1="test";}
Observations:
fields in the source method class do matter somehow (without the field, the bug does not appear)
making the replacement non-static does not exhibit the bug
changing the bool? to int? won't trigger the bug
The text was updated successfully, but these errors were encountered:
For reference, these are the matrix tests that failed before I removed the test that tests the above case. You can see that it works on many platforms but not on all:
Description
This is a follow up from this bug report on Harmony: pardeike/Harmony#640
I cooked it down to a minimal case without Harmony or dynamic methods:
Example
Observations:
bool?
toint?
won't trigger the bugThe text was updated successfully, but these errors were encountered: