HarmonyX icon indicating copy to clipboard operation
HarmonyX copied to clipboard

Leaking Mono.Cecil.* types from the vanilla Harmony

Open Aragas opened this issue 1 year ago • 3 comments

Hello! I'm trying to switch the Bannerlord's ecosystem to HarmonyX, but there are mods that use publicly available Mono.Cecil.* types like Mono.Cecil.ModuleDefinition from the 0Harmony.dll assembly. Could Type Forwarding be added similar to how BepinEx does that? (https://github.com/BepInEx/BepInEx.MelonLoader.Loader/tree/master/MelonLoader/BackwardsCompatibility/ForwardingAttributes)

Aragas avatar Mar 02 '23 08:03 Aragas

Which version of Harmony is currently being used? Are you using BepInEx or a different modding framework? (in which case, do you have the 0Harmony20 shim?)

ManlyMarco avatar Mar 02 '23 09:03 ManlyMarco

Harmony 2.2.2. BepinEx is not used, but we'll make our own loader soon, as we need to support both .NET Framework 472 and .NET Core 3.1 versions of the game. I already ported the type forwarding locally and I do confirm that this fixed the type leakage

Aragas avatar Mar 02 '23 10:03 Aragas

There are some patching behaviour issues I noticed. Reverse patcher's transpilers inject the wrong method with the MethodBase method parameter. Vanilla Harmony returns the method that is being reverse-patched, HarmonyX returns the blank method that is used for the IL injection

Aragas avatar Mar 02 '23 10:03 Aragas