-
Couldn't load subscription status.
- Fork 6
Description
Typically, OnShutdown should be called when a mod is hot-reloaded and/or when MonkeyLoader shutdown. At the current state OnShutdown never gets called which cause previous iterations of a particular mod to accumulate (Chained). You could use [HarmonyPrepare] attribute to check for a previous version of the patch but this is just a duck tape solution for now.
It seems that while debugging the MonkeyLoader code I found there was a string mismatch occurring specifically with the mod's file location. At initial loading of the mods though LoadMod(string, bool) the path should be "./MonkeyLoader/Mods\\mods.nupkg" but a function specifically Path.GetFullPath will change this to "D:\\<SOMEDIRECTORY>\\Resonite\\MoneyLoader\\mods.nupkg". Later on TryFindModByLocation will fail to find the mod since "D:\\<SOMEDIRECTORY>\\Resonite\\MoneyLoader\\mods.nupkg" does not match the location string provided by the FileSystemEventArgs from OnUnloadMod "./MonkeyLoader/Mods\\mods.nupkg". Therefore, silently failing to call OnShutdown on mods.
Simply removing Path.GetFullPath fixed the issue.
Now, I know why my mod was acting so strange :(.
