AnimationLoader icon indicating copy to clipboard operation
AnimationLoader copied to clipboard

Better handle invalid/corrupted animation zipmods

Open ManlyMarco opened this issue 8 months ago • 1 comments

Catch failed zipmod loads and provide a useful message to help debug the issue. Currently it's just:

XmlException: Data at the root level is invalid. Line 1, position 1. at System.Xml.XmlTextReaderImpl.Throw (System.Exception e) [0x00027] in <1d98d70bb7d8453b80c25aa561fdecd1>:0 at System.Xml.XmlTextReaderImpl.Throw (System.String res, System.String arg) [0x00029] in <1d98d70bb7d8453b80c25aa561fdecd1>:0 at System.Xml.XmlTextReaderImpl.Throw (System.String res) [0x00000] in <1d98d70bb7d8453b80c25aa561fdecd1>:0 at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace () [0x0012c] in <1d98d70bb7d8453b80c25aa561fdecd1>:0 at System.Xml.XmlTextReaderImpl.ParseDocumentContent () [0x002d4] in <1d98d70bb7d8453b80c25aa561fdecd1>:0 at System.Xml.XmlTextReaderImpl.Read () [0x0008c] in <1d98d70bb7d8453b80c25aa561fdecd1>:0 at System.Xml.XmlTextReader.Read () [0x00000] in <1d98d70bb7d8453b80c25aa561fdecd1>:0 at System.Xml.XmlReader.MoveToContent () [0x0003a] in <1d98d70bb7d8453b80c25aa561fdecd1>:0 at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderUsedAnimations.Read3_Animations () [0x00008] in <2ffcb7f16a044af3bc60f23de2c66c40>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in :0 Rethrow as InvalidOperationException: There is an error in XML document (1, 1). at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.XmlReader xmlReader, System.String encodingStyle, System.Xml.Serialization.XmlDeserializationEvents events) [0x0011b] in <1d98d70bb7d8453b80c25aa561fdecd1>:0 at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.XmlReader xmlReader, System.String encodingStyle) [0x00000] in <1d98d70bb7d8453b80c25aa561fdecd1>:0 at System.Xml.Serialization.XmlSerializer.Deserialize (System.IO.Stream stream) [0x0001c] in <1d98d70bb7d8453b80c25aa561fdecd1>:0 at AnimationLoader.UsedAnimations.Read () [0x00022] in <3ee9350102704cfea00069f47a558609>:0 at AnimationLoader.SwapAnim.Start () [0x00000] in <3ee9350102704cfea00069f47a558609>:0

Which later results in:

NullReferenceException: Object reference not set to an instance of an object at AnimationLoader.SwapAnim+Hooks.ExtendList (System.Object __instance) [0x0003e] in <3ee9350102704cfea00069f47a558609>:0 at (wrapper dynamic-method) HSceneProc.DMDHSceneProc::CreateAllAnimationList(HSceneProc) at (wrapper dynamic-method) HSceneProc.DMDHSceneProc::CreateListAnimationFileName(HSceneProc,bool) at (wrapper dynamic-method) HSceneProc+<Start>d__153.DMD<HSceneProc+<Start>d__153::MoveNext>(HSceneProc/<Start>d__153) at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <548b4fa0e7e04f27a1b7580930bfb7dc>:0

It would help in cases like #33

ManlyMarco avatar Jun 06 '24 19:06 ManlyMarco