We use your SyntaxEditor with .Net and Web Language Add-ons.
As mentioned before by my colleague Matthias Kossiek, we parse the XML in Syntax Editor using something like:
XmlParseData parseData = xmlEditor.Document.ParseData as XmlParseData;
and then we add every parseData.Ast (IAstNode) and all Children to a List.
This results in a hierarchical list of DefaultAstNodes.
From time to time, a kind of interesting problem occurs:
The SyntaxEditor Text and the described XML in the AST-Nodes get out of sync. At this point in the program, I can make whatever changes I want in the SyntaxEditor (I can even remove the whole XML it contains), but the AST-Nodes we get from the xmlEditor.Document.ParseData still refer to the old content of the SyntaxEditor.
We managed to detect this error by comparing the content of the EditorDocument EditorDocument.Text with the snapshot of the parseData (this.xamlWorkerEditorDocument.ParseData.Snapshot.Text).
As soon as this comparison detects a difference between those two strings, the AST-Nodes are out of sync with the Document content and our application cannot continue working correctly anymore.
In some cases we can even visually see that the described error has occurred. In the SyntaxEditor there is this red wiggly error line for the detected error in the document. Once we are in the error state, we can see this error line at the end of the document underlining a non-existing last character of the document (which cannot be deleted). We can even select the document content by pressing strg+a and then delete everything by pressing the del button, but there is still that red wiggly error line.
The problem is that this error is hard to reproduce and only occurs every two or three weeks.
I hope you have an idea what we are doing wrong and can help us solve the problem.
Thanks in advance for your help :)