knah/Il2CppAssemblyUnhollower

Patched methods break exception propagation

Closed this issue · 1 comments

If a (patched) game method throws and exception, the trampoline code will complain about the exception (thus breaking the exception flow) and won't execute the postfix/prefix.

Example stack trace:

[Error  :    Detour] UnhollowerBaseLib.Il2CppException: System.NullReferenceException: Object reference not set to an instance of an object.

  at UnhollowerBaseLib.Il2CppException.RaiseExceptionIfNecessary (System.IntPtr returnedException) [0x00014] in <777559d3b76a4c3e8ec3d7f2e15ce0fa>:0
  at (wrapper dynamic-method) LevelGeneration.LG_MarkerFactory.DMD<LevelGeneration.LG_MarkerFactory::InstantiateMarkerGameObject>(LG_MarkerSpawner,GameData.ExpeditionFunction,single,single,single,bool&,bool)
  at (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.(il2cpp -> managed) InstantiateMarkerGameObject(intptr,GameData.ExpeditionFunction,single,single,single,byte&,bool,UnhollowerBaseLib.Runtime.Il2CppMethodInfo*)
knah commented

In general, this would be an issue with the patching library, not Unhollower. However, support from unhollower would be nice to have, so I created a separate issue in #51 for rethrow support.