HarmonyX
HarmonyX copied to clipboard
__state is mapped by FullName instead of AssemblyQualifiedName
Similarly to https://github.com/pardeike/Harmony/issues/408, this repository has the same problem: __state
is shared between all methods with the same fullname, but from different assemblies.
This was fixed in https://github.com/pardeike/Harmony/commit/b906d0409a5bb1315ae323de8ac4942e33217b06 by replacing occurrences of FullName
by AssemblyQualifiedName
in MethodPatcher.cs (here, the file is Harmony/Public/Patching/HarmonyManipulator.cs).
We in the BattleTech modding community are actually relying on FullName
.
Due to only recently allowing HarmonyX, all mods need Hamony1 and expect some old prefix behavior for skipping, so we wrap those nicely. Wrappers are created in dynamically assemblied assembiles, but with the same FullName
as the original patch method. Postfixes and prefixes would not be connected anymore if AssemblyQualifiedName
is suddenly used, as they are in different assemblies.
I really wish we could just specify an identifier via an attribute, that the __state variable is then using instead of that implicit stuff. Its already bad enough that for __state to work, pre and postfix have to be in the same class.