MBINCompiler icon indicating copy to clipboard operation
MBINCompiler copied to clipboard

Improve error details about IndexOutOfRangeException

Open Dwarden opened this issue 6 years ago • 3 comments

Description I ran into error [IndexOutOfRangeException]: Index was outside the bounds of the array. It would be nice if mbincompiler returned some details to narrow the source of it.

Solution Return exml line where the error happens Return the array / element name for which the error happens

thanks in advance , after any complex edits it would make life easier to track compiling issues

Full Error below

[ERROR]: [AggregateException]: One or more errors occurred. [ExmlException]: An EXML exception has occurred! [IndexOutOfRangeException]: Index was outside the bounds of the array.

at System.Array.InternalGetReference(Void* elemRef, Int32 rank, Int32* pIndices) at System.Array.SetValue(Object value, Int32 index) at libMBIN.NMSTemplate.DeserializeEXmlValue(NMSTemplate template, Type fieldType, FieldInfo field, EXmlProperty xmlProperty, Type templateType, NMSAttribute settings) at libMBIN.NMSTemplate.DeserializeEXml(EXmlBase xmlData) at libMBIN.NMSTemplate.DeserializeEXml(EXmlBase xmlData) at libMBIN.EXmlFile.ReadTemplateFromXmlReader(XmlReader reader, String& templateName) at libMBIN.EXmlFile.ReadTemplateFromStream(Stream input, String& templateName) at MBINCompiler.Commands.Convert.ConvertEXML(String inputPath, FileStream fIn, MemoryStream msOut, String fileOut)

Dwarden avatar Aug 23 '19 11:08 Dwarden

I'll look into it. I definitely want to improve the error reporting so I'll try add some functionality into the code so that the struct at least is passed into the error message (line is too complex to try and implement I think...)

monkeyman192 avatar Aug 23 '19 14:08 monkeyman192

thank you for your time

Dwarden avatar Aug 24 '19 01:08 Dwarden

Ok, having a quick look now... Can you send me your exml file that gave you this error? I tried to emulate it but got

[ArraySizeException]: CharacterStates: XML array size 17 doesn't match expected array size 16

(for the exml file I used) If you attach the exml file that gave you your error then I can see how it was caused a bit easier and fix up the error message :)

monkeyman192 avatar Aug 25 '19 11:08 monkeyman192