drok / Harmony-CitiesSkylines

Harmony 2.x assembly provider mod for Cities: Skylines
Other
13 stars 3 forks source link

Harmony v0.9.21 flags later updated libs as unsupported #19

Open drok opened 2 years ago

drok commented 2 years ago

When Harmony v0.9.21 is active, and another more updated version is present but disabled, v0.9.21 flags the later instance as unsupported. This is wrong. Steps to reproduce:

In this case, the active v0.9.21 will throw the following error:

HarmonyModSupportException: Unsupported HarmonyLib implementations: 0Harmony[2.0.400.0]
  at HarmonyMod.Patcher.ImplementAdditionalVersionSupport (Boolean needHarmon1StateTransfer) [0x00000] in <filename unknown>:0 
  at HarmonyMod.Mod.IAwareness.IAmAware.OnHarmonyAccessBeforeAwareness (Boolean needHarmon1StateTransfer) [0x00000] in <filename unknown>:0 
  at HarmonyLib.Harmony+<>c.<get_isEnabled>b__28_2 (System.Type p) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.Any[Type] (IEnumerable`1 source, System.Func`2 predicate) [0x00000] in <filename unknown>:0 
  at HarmonyLib.Harmony.get_isEnabled () [0x00000] in <filename unknown>:0 
  at HarmonyLib.Harmony..ctor (System.String id, System.Reflection.MethodBase _caller) [0x00000] in <filename unknown>:0 
  at HarmonyLib.Harmony..ctor (System.String id) [0x00000] in <filename unknown>:0 
  at FindIt.Patcher.PatchAll () [0x00000] in <filename unknown>:0 
  at FindIt.ModInfo+<>c.<OnEnabled>b__9_0 () [0x00000] in <filename unknown>:0 
  at CitiesHarmony.API.HarmonyHelper.DoOnHarmonyReady (System.Action action) [0x00000] in <filename unknown>:0 
  at FindIt.ModInfo.OnEnabled () [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at ColossalFramework.Plugins.PluginManager.AddPlugins (System.Collections.Generic.Dictionary`2 plugins) [0x00000] in <filename unknown>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
ColossalFramework.Plugins.PluginManager:AddPlugins(Dictionary`2)
ColossalFramework.Plugins.PluginManager:LoadPlugins()
Starter:Awake()

This happens the first time the Harmony Mod checks the loaded assemblies looking for unrecognized versions. Versions signed by the same public key should be assumed to be backwards compatible and not unsupported.