drok / Harmony-CitiesSkylines

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

PatchInfoSerialization.Deserialize fault when Healkit is disabled #6

Closed drok closed 3 years ago

drok commented 3 years ago

When turning off the Extended Error Reporting mod (Harmony 1.2.0.1), it causes a HarmonyLib deserialization error:

System.TypeLoadException: Could not load type 'Harmony.Patch[]

HarmonyLib.PatchInfoSerialization.Deserialize

System.Exception: A Mod caused an error ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type 'Harmony.Patch[]'.
at (wrapper managed-to-native) System.Reflection.Assembly.InternalGetType (System.Reflection.Module,string,bool,bool) <IL 0x00018, 0x0012b>
at System.Reflection.Assembly.GetType (string,bool,bool) <IL 0x0002d, 0x00181>
at System.Reflection.Assembly.GetType (string,bool) <IL 0x00004, 0x00066>
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetDeserializationType (long,string) <IL 0x00042, 0x00221>
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadType (System.IO.BinaryReader,System.Runtime.Serialization.Formatters.Binary.TypeTag) <IL 0x000d2, 0x00504>
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadTypeMetadata (System.IO.BinaryReader,bool,bool) <IL 0x00085, 0x00542>
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectInstance (System.IO.BinaryReader,bool,bool,long+,object+,System.Runtime.Serialization.SerializationInfo+) <IL 0x0000e, 0x000bc>
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (System.Runtime.Serialization.Formatters.Binary.BinaryElement,System.IO.BinaryReader,long+,object+,System.Runtime.Serialization.SerializationInfo+) <IL 0x000a6, 0x002ab>
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (System.Runtime.Serialization.Formatters.Binary.BinaryElement,System.IO.BinaryReader,long+,object+,System.Runtime.Serialization.SerializationInfo+) <IL 0x00112, 0x0056a>
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.Runtime.Serialization.Formatters.Binary.BinaryElement,System.IO.BinaryReader) <IL 0x0002d, 0x00150>
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (System.Runtime.Serialization.Formatters.Binary.BinaryElement,System.IO.BinaryReader,bool,object+,System.Runtime.Remoting.Messaging.Header[]+) <IL 0x00007, 0x00082>
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream,System.Runtime.Remoting.Messaging.HeaderHandler) <IL 0x00080, 0x00488>
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream) <IL 0x00003, 0x00057>
at HarmonyLib.PatchInfoSerialization.Deserialize (byte[]) <IL 0x00018, 0x0014a>
at HarmonyLib.HarmonySharedState.GetPatchInfo (System.Reflection.MethodBase) <IL 0x00025, 0x001f5>
at HarmonyLib.PatchProcessor.GetPatchInfo (System.Reflection.MethodBase) <IL 0x0000d, 0x000ad>
at HarmonyLib.Harmony.GetPatchInfo (System.Reflection.MethodBase) <IL 0x00013, 0x000ec>
at HarmonyLib.Harmony.UnpatchAll (string) <IL 0x00054, 0x0030f>
at HarmonyMod.Harmony1SelfPatcher.HarmonyInstance_UnpatchAll_Prefix (string,string) <IL 0x00007, 0x0009c>
at (wrapper dynamic-method) Harmony.HarmonyInstance.Harmony.HarmonyInstance.UnpatchAll_Patch1 (Harmony.HarmonyInstance,string) <IL 0x0001d, 0x0010f>
at HealkitMod.ModInfo.OnDisabled () <IL 0x0000b, 0x00075>
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (object,object[],System.Exception+) <IL 0x00016, 0x0011f>
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x000d6, 0x005d5>

  --- End of inner exception stack trace ---
  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+PluginInfo.set_isEnabled (Boolean value) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
drok commented 3 years ago

This is also triggered as "Cannot cast from source type to destination type",

ModException: The Mod C:\Program Files (x86)\Steam\steamapps\workshop\content\255710\2053500739 [AdvancedOutsideConnection.dll] has caused an error ---> System.InvalidCastException: Cannot cast from source type to destination type.
at Harmony.PatchInfoSerialization.Deserialize (byte[]) <0x000fc>
at Harmony.HarmonySharedState.GetPatchInfo (System.Reflection.MethodBase) <0x0006b>
at Harmony.PatchProcessor.Patch () <0x001bd>
at Harmony.HarmonyInstance.<PatchAll>b__9_0 (System.Type) <0x000ed>
at Harmony.CollectionExtensions.Do<System.Type> (System.Collections.Generic.IEnumerable`1<System.Type>,System.Action`1<System.Type>) <0x000a7>
at Harmony.HarmonyInstance.PatchAll (System.Reflection.Assembly) <0x00087>
at Harmony.HarmonyInstance.PatchAll () <0x000b8>
at AdvancedOutsideConnection.LoadingExtension.Init (bool) <0x0002e>
at AdvancedOutsideConnection.LoadingExtension.OnLevelLoaded (ICities.LoadMode) <0x00031>
at (wrapper dynamic-method) LoadingWrapper.LoadingWrapper.OnLevelLoaded_Patch5 (LoadingWrapper,SimulationManager/UpdateMode) <0x000b9>

  --- End of inner exception stack trace ---
drok commented 3 years ago

Fixed in 8f1c006 Verified by OR