microsoft / XmlNotepad

XML Notepad provides a simple intuitive User Interface for browsing and editing XML documents.

Home Page:https://microsoft.github.io/XmlNotepad/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unhandled exception on XML file load of XML document known to accepted by target entity

slundahl2 opened this issue · comments

The unhandled exception below occurs in the XmlCache.cs method FireModelChanged() line:
this.ModelChanged(this, new ModelChangedEventArgs(t, node));

It occurred while attempting to load the attached file which was successfully uploaded to CrossRef.org for DOI processing. (I have changed the user information in the XML file.)

I did not debug further to see what is null. I do know that the XML is valid and served its purpose.
ValidXmlForXMLNotePadIssueSubmitted.txt

Error:
System.ArgumentNullException
HResult=0x80004003
Message=Value cannot be null.
Parameter name: uriString
Source=System
StackTrace:
at System.Uri..ctor(String uriString)
at XmlNotepad.SchemaCache.Add(XmlSchema s) in D:\Projects\XmlNotepad\src\Model\SchemaCache.cs:line 259
at XmlNotepad.SchemaCache.AddImports(XmlSchema parent) in D:\Projects\XmlNotepad\src\Model\SchemaCache.cs:line 297
at XmlNotepad.SchemaCache.Add(XmlSchema s) in D:\Projects\XmlNotepad\src\Model\SchemaCache.cs:line 268
at XmlNotepad.SchemaCache.AddImports(XmlSchema parent) in D:\Projects\XmlNotepad\src\Model\SchemaCache.cs:line 297
at XmlNotepad.SchemaCache.Add(XmlSchema s) in D:\Projects\XmlNotepad\src\Model\SchemaCache.cs:line 268
at XmlNotepad.SchemaCache.AddImports(XmlSchema parent) in D:\Projects\XmlNotepad\src\Model\SchemaCache.cs:line 297
at XmlNotepad.SchemaCache.Add(XmlSchema s) in D:\Projects\XmlNotepad\src\Model\SchemaCache.cs:line 268
at XmlNotepad.Checker.ValidateContext(XmlCache xcache) in D:\Projects\XmlNotepad\src\Model\Checker.cs:line 91
at XmlNotepad.Checker.Validate(XmlCache xcache) in D:\Projects\XmlNotepad\src\Model\Checker.cs:line 130
at XmlNotepad.XmlCache.ValidateModel(ErrorHandler handler) in D:\Projects\XmlNotepad\src\Model\XmlCache.cs:line 103
at XmlNotepad.FormMain.OnModelChanged() in D:\Projects\XmlNotepad\src\Application\FormMain.cs:line 1504
at XmlNotepad.FormMain.OnModelChanged(Object sender, ModelChangedEventArgs e) in D:\Projects\XmlNotepad\src\Application\FormMain.cs:line 1497
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at XmlNotepad.XmlCache.FireModelChanged(ModelChangeType t, XmlNode node) in D:\Projects\XmlNotepad\src\Model\XmlCache.cs:line 652
at XmlNotepad.XmlCache.Load(XmlReader reader, String fileName) in D:\Projects\XmlNotepad\src\Model\XmlCache.cs:line 219
at XmlNotepad.XmlCache.Load(String file) in D:\Projects\XmlNotepad\src\Model\XmlCache.cs:line 191
at XmlNotepad.FormMain.InternalOpen(FileEntity entity) in D:\Projects\XmlNotepad\src\Application\FormMain.cs:line 1088
at XmlNotepad.FormMain.d__93.MoveNext() in D:\Projects\XmlNotepad\src\Application\FormMain.cs:line 984

This exception was originally thrown at this call stack:
[External Code]
XmlNotepad.SchemaCache.Add(System.Xml.Schema.XmlSchema) in SchemaCache.cs
XmlNotepad.SchemaCache.AddImports(System.Xml.Schema.XmlSchema) in SchemaCache.cs
XmlNotepad.SchemaCache.Add(System.Xml.Schema.XmlSchema) in SchemaCache.cs
XmlNotepad.SchemaCache.AddImports(System.Xml.Schema.XmlSchema) in SchemaCache.cs
XmlNotepad.SchemaCache.Add(System.Xml.Schema.XmlSchema) in SchemaCache.cs
XmlNotepad.SchemaCache.AddImports(System.Xml.Schema.XmlSchema) in SchemaCache.cs
XmlNotepad.SchemaCache.Add(System.Xml.Schema.XmlSchema) in SchemaCache.cs
XmlNotepad.Checker.ValidateContext(XmlNotepad.XmlCache) in Checker.cs
XmlNotepad.Checker.Validate(XmlNotepad.XmlCache) in Checker.cs
...
[Call Stack Truncated]

Great bug, thanks. I pushed some fixes which will be included in the next build, but I'm still seeing validation errors which may or may not be another problem, so I need you to check those errors and file a new bug if the schemaset is not working properly.

Ok I published new version, so this is fixed in 2.9.0.8

Hi Steven, it was a bug, your schema set is very complex which turned out to be a great test, it exposed a bug in the schema handling, the actual fixes are in the SchemaCache.cs and Checker.cs in this commit. The proxy.cs changes moving to HttpClient also helps with loading of your schemas, the old WebRequest was timing out on some of them when I was testing it.