Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaking Mono.Cecil.* types from the vanilla Harmony #67

Open
Aragas opened this issue Mar 2, 2023 · 3 comments
Open

Leaking Mono.Cecil.* types from the vanilla Harmony #67

Aragas opened this issue Mar 2, 2023 · 3 comments

Comments

@Aragas
Copy link
Contributor

Aragas commented Mar 2, 2023

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)

@ManlyMarco
Copy link
Member

ManlyMarco commented Mar 2, 2023

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?)

@Aragas
Copy link
Contributor Author

Aragas commented Mar 2, 2023

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
Copy link
Contributor Author

Aragas commented Mar 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants