MelonLoader

MelonLoader

242 Downloads

[Bug]: NRE Issue with MonoMod

HerpDerpinstine opened this issue ยท 2 comments

commented

MonoMod seems to throw an exception for this type initializer.
Commit 8198cbb fixes the issue by downgrading MonoMod.RuntimeDetour and HarmonyX a single version.

This obviously isn't the best solution and a proper fix should be looked into.

Below is the exception logged:

[22:30:51.976] [ERROR] System.TypeInitializationException: An exception was thrown by the type initializer for HarmonyLib.AccessTools
---> System.TypeInitializationException: An exception was thrown by the type initializer for MonoMod.Utils.DynamicMethodDefinition
---> System.TypeInitializationException: An exception was thrown by the type initializer for MonoMod.Utils.ReflectionHelper
---> System.NullReferenceException: Object reference not set to an instance of an object

  at MonoMod.Utils.ReflectionHelper..cctor () [0x00000] in <filename unknown>:0 

  --- End of inner exception stack trace ---

  at MonoMod.Utils.DynamicMethodDefinition..cctor () [0x00000] in <filename unknown>:0 

  --- End of inner exception stack trace ---

  at HarmonyLib.MethodInvoker.GetHandler (System.Reflection.MethodInfo methodInfo, Boolean directBoxValueAccess) [0x00000] in <filename unknown>:0 

  at HarmonyLib.AccessTools..cctor () [0x00000] in <filename unknown>:0 

  --- End of inner exception stack trace ---

  at HarmonyLib.Internal.RuntimeFixes.StackTraceFixes.Install () [0x00000] in <filename unknown>:0 
commented

Looks like this has actually been fixed in monomod since june (MonoMod/MonoMod.Common@310f8dc) but this commit has just never made it into a release. They're going to try to sort this out now.

commented

Would this have been addressed by 8243dec?

Since then, however, #444 and #469 have popped up which also refer back to MonoMod.

@SamboyCoding: Any insight on the two issues above?