Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy loaded highlight definition failing when clear and add assemblies #3343

Open
sgkoishi opened this issue Nov 30, 2024 · 5 comments
Open
Labels
Bug Feedback Needed This issue requires user feedback

Comments

@sgkoishi
Copy link

Steps to reproduce

It just happened when I cleared the assembly list and added a new one. With default light theme I got this error, and it works if I switch to any other theme and back to light theme again.

Error message shown

ICSharpCode.AvalonEdit.Highlighting.HighlightingDefinitionInvalidException: Error delay-loading highlighting definition
 ---> ICSharpCode.AvalonEdit.Highlighting.HighlightingDefinitionInvalidException: Error at position (line 47, column 26):
There is an unclosed literal string. Line 47, position 26.
 ---> System.Xml.XmlException: There is an unclosed literal string. Line 47, position 26.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
   at System.Xml.XmlTextReaderImpl.ParseAttributes()
   at System.Xml.XmlTextReaderImpl.ParseElement()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at System.Xml.XmlCharCheckingReader.Read()
   at System.Xml.XmlCharCheckingReader.Read()
   at System.Xml.XsdValidatingReader.Read()
   at ICSharpCode.AvalonEdit.Highlighting.Xshd.V2Loader.ParseElements(ICollection`1 c, XmlReader reader)
   at ICSharpCode.AvalonEdit.Highlighting.Xshd.V2Loader.ParseDefinition(XmlReader reader)
   at ICSharpCode.AvalonEdit.Highlighting.Xshd.V2Loader.LoadDefinition(XmlReader reader, Boolean skipValidation)
   at ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.LoadXshd(XmlReader reader, Boolean skipValidation)
   --- End of inner exception stack trace ---
   at ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.LoadXshd(XmlReader reader, Boolean skipValidation)
   at ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.LoadXshd(XmlReader reader)
   at ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load(XmlReader reader, IHighlightingDefinitionReferenceResolver resolver)
   at ICSharpCode.ILSpy.TextView.ExtensionMethods.<>c__DisplayClass0_0.<RegisterHighlighting>b__0()
   at ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.DelayLoadedHighlightingDefinition.GetDefinition()
   --- End of inner exception stack trace ---
   at ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.DelayLoadedHighlightingDefinition.GetDefinition()
   at ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.DelayLoadedHighlightingDefinition.GetNamedColor(String name)
   at ICSharpCode.ILSpy.CSharpHighlightingTokenWriter..ctor(TokenWriter decoratedWriter, ISmartTextOutput textOutput, ILocatable locatable)
   at ICSharpCode.ILSpy.CSharpLanguage.WriteCode(ITextOutput output, DecompilerSettings settings, SyntaxTree syntaxTree, IDecompilerTypeSystem typeSystem)
   at ICSharpCode.ILSpy.CSharpLanguage.DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
   at ICSharpCode.ILSpy.TreeNodes.AssemblyTreeNode.Decompile(Language language, ITextOutput output, DecompilationOptions options)
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.DecompileNodes(DecompilationContext context, ITextOutput textOutput)
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.<>c__DisplayClass58_0.<DecompileAsync>b__0()

The inner exception changes, e.g.

ICSharpCode.AvalonEdit.Highlighting.HighlightingDefinitionInvalidException: Error delay-loading highlighting definition
 ---> ICSharpCode.AvalonEdit.Highlighting.HighlightingDefinitionInvalidException: Error at position (line 1, column 1):
Data at the root level is invalid. Line 1, position 1.
 ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlReader.MoveToContent()
   at ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.LoadXshd(XmlReader reader, Boolean skipValidation)
   --- End of inner exception stack trace ---
   at ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.LoadXshd(XmlReader reader, Boolean skipValidation)
   at ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.LoadXshd(XmlReader reader)
   at ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load(XmlReader reader, IHighlightingDefinitionReferenceResolver resolver)
   at ICSharpCode.ILSpy.TextView.ExtensionMethods.<>c__DisplayClass0_0.<RegisterHighlighting>b__0()
   at ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.DelayLoadedHighlightingDefinition.GetDefinition()
   --- End of inner exception stack trace ---
   at ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.DelayLoadedHighlightingDefinition.GetDefinition()
   at ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.DelayLoadedHighlightingDefinition.GetNamedColor(String name)
   at ICSharpCode.ILSpy.CSharpHighlightingTokenWriter..ctor(TokenWriter decoratedWriter, ISmartTextOutput textOutput, ILocatable locatable)
   at ICSharpCode.ILSpy.CSharpLanguage.WriteCode(ITextOutput output, DecompilerSettings settings, SyntaxTree syntaxTree, IDecompilerTypeSystem typeSystem)
   at ICSharpCode.ILSpy.CSharpLanguage.DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
   at ICSharpCode.ILSpy.TreeNodes.AssemblyTreeNode.Decompile(Language language, ITextOutput output, DecompilationOptions options)
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.DecompileNodes(DecompilationContext context, ITextOutput textOutput)
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.<>c__DisplayClass58_0.<DecompileAsync>b__0()

Details

  • ILSpy 9.0 preview 3
@sgkoishi sgkoishi added the Bug label Nov 30, 2024
@greenozon
Copy link

I hit similar issue some weeks ago - #3301
but it was very mysterious so once appeared, it disappeared afterwards...

@sgkoishi
Copy link
Author

sgkoishi commented Nov 30, 2024

I hit similar issue some weeks ago - #3301 but it was very mysterious so once appeared, it disappeared afterwards...

For me it works if you have any assemblies loaded. It breaks when there's no assembly in the list and you drag the first one to it, exactly the same as your video.
It will disappear in the current launch if you switch the theme, and appears if you didn't switch theme and keep remove assemblies and add them back.

@greenozon
Copy link

The thing is it is not 100% reproducible... eg right now I don't have it, so there must be some env. dependent things that impacts it somehow...

@sgkoishi
Copy link
Author

Make sense - I had #3289 if I decompress ILSpy portable to a specific one empty directory, but not if I create and decompress to another empty directory in the previous one 😵

@siegfriedpammer
Copy link
Member

Would be nice to get some consistent repro, because these errors are really strange. Thank you both!

@christophwille christophwille added the Feedback Needed This issue requires user feedback label Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Feedback Needed This issue requires user feedback
Projects
None yet
Development

No branches or pull requests

4 participants