Mods that do not use the API mechanisms for checking that Harmony is installed before use will eventually be denied Harmony access.
Mods should use IsHarmonyInstalled and DoOnHarmonyReady() before creating Harmony instances. This allows the API to ensure that if the Harmony Library is not installed at the time the mod is ready to use it, it will be subscribed and the mod be
notified when ready.
The alternative is that attempting to create a Harmony instance without the assembly present will cause an TypeLoadException for a few users (those who install the troubled mod for the first time, not having any other Harmony mods already installed).
There are many mods that do not use the DoOnHarmonyReady() protocol currently, and in order to provide a smoother transition, the Harmony Mod only warns. Currently it is planned that at version v1.1 of the Harmony mod, the warnings will
become denials for those mods that still misuse the interface.
Note this issue is similar to #9 but it happens not on mod enumeration, but at OnEnable(), OnLevelLoaded() or wherever the mod attempts to instantiate Harmony. The error is TypeLoadException, not ReflectionTypeLoadException as in #9.
Practical effects
When loading a city with the mod enabled, but without Harmony present, the CitiesHarmony.API is expected to pop up a warning explaining that Harmony is required but is not installed. Instead, the following AN ERROR HAS OCCURRED unhandled exception panel is shown to the unsuspecting player (this error doesn't give any actionable help):
The Mod D:\Users\Radu\AppData\Local\Colossal Order\Cities_Skylines\Addons\Mods\PopulationDemographics [CitiesHarmony.API.dll, PopulationDemographics.dll] has caused an error [ModException]
Details:
System.TypeLoadException: A type load exception has occurred.
at LoadingWrapper.OnLevelLoaded (UpdateMode mode) [0x00000] in <filename unknown>:0
How to test if your mod is affected
First Time User Scenario (user forgot to also subscribe the dependency Harmony):
Subscribe both your mod and Harmony.
delete the Harmony mod folder from the workshop folder.
Load a city
Observe crash displayed in "AN ERROR OCCURRED" exception window
User of local mods. (Epic Games players; content creators who require a stable, un-updated set of mods for production work; Players who run the game offline, on airplanes, for example; generally new players who are unaware of the Harmony workings):
Subscribe your mod.
Copy your mod to local %LOCALAPPDATA%. Do not copy the Harmony folder locally.
Start the game with --noWorkshop.
Observe crash displayed in "AN ERROR OCCURRED" exception window
Player who switches from boformer's Harmony to the redesigned (this) Harmony (users who want to access the Harmony Report to diagnose their mod collection issue):
Mods that do not use the API mechanisms for checking that Harmony is installed before use will eventually be denied Harmony access.
Mods should use
IsHarmonyInstalled
andDoOnHarmonyReady()
before creating Harmony instances. This allows the API to ensure that if the Harmony Library is not installed at the time the mod is ready to use it, it will be subscribed and the mod be notified when ready.The alternative is that attempting to create a Harmony instance without the assembly present will cause an TypeLoadException for a few users (those who install the troubled mod for the first time, not having any other Harmony mods already installed).
There are many mods that do not use the
DoOnHarmonyReady()
protocol currently, and in order to provide a smoother transition, the Harmony Mod only warns. Currently it is planned that at version v1.1 of the Harmony mod, the warnings will become denials for those mods that still misuse the interface.Note this issue is similar to #9 but it happens not on mod enumeration, but at
OnEnable()
,OnLevelLoaded()
or wherever the mod attempts to instantiate Harmony. The error is TypeLoadException, not ReflectionTypeLoadException as in #9.Practical effects
When loading a city with the mod enabled, but without Harmony present, the CitiesHarmony.API is expected to pop up a warning explaining that Harmony is required but is not installed. Instead, the following AN ERROR HAS OCCURRED unhandled exception panel is shown to the unsuspecting player (this error doesn't give any actionable help):
How to test if your mod is affected
%LOCALAPPDATA%
. Do not copy the Harmony folder locally.--noWorkshop
.