The Harmony.UnpatchAll() with a null argument or no argument causes all patches to be removed (globally).
Some mods use this call as a quick an easy way to cleanup at OnDisable() time.
This corrupts the state of the Harmony Mod itself, which needs harmony1 patches to remain installed, as well as it's own exception hooks.
There needs to be a way to disallow mods from performing certain actions, like UnpatchAll(), removing patches applied by the Harmony Mod, or patching the mod itself.
Solution
The correct way to remove the mod's own patches is to give UnpatchAll() the same argument used to instantiate Harmony. Eg. if you have new Harmony("my.mod.name"), unpatch with UnpatchAll("my.mod.name")
The
Harmony.UnpatchAll()
with a null argument or no argument causes all patches to be removed (globally).Some mods use this call as a quick an easy way to cleanup at
OnDisable()
time.This corrupts the state of the Harmony Mod itself, which needs harmony1 patches to remain installed, as well as it's own exception hooks.
There needs to be a way to disallow mods from performing certain actions, like UnpatchAll(), removing patches applied by the Harmony Mod, or patching the mod itself.
Solution
The correct way to remove the mod's own patches is to give
UnpatchAll()
the same argument used to instantiate Harmony. Eg. if you havenew Harmony("my.mod.name")
, unpatch withUnpatchAll("my.mod.name")