WPF Studio with .Net and Web Language Add-ons.

SyntaxEditor Web Languages Add-on for WPF Forum

Posted 12 years ago by P. O. - Inosoft GmbH
Version: 11.2.0552
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar

Hello!


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 :)
P. Chwoika

Comments (4)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

So to confirm, you are saying that the document's parse data stops getting updated when this scenario occurs?  The only time we've ever seen that happen is if something in the parser got stuck in some sort of infinite loop while parsing.  We haven't heard of that happening with our XML language though.  You can tell if that is the case if when this scenario occurs, you break execution a few seconds after a text change (after the time by which a parse should have asynchronously completed) and then look in Visual Studio to see what the parser thread is currently doing.  If it's in a parse still (bad), or waiting for another parse request in the queue (good).

If it is a bug in our parser that is entering a loop, you should be able to reproduce it simply by pasting the XML in a SyntaxEditor that triggered the scenario.  So next time you detect it, save your XML immediately and see if reopening the same XML causes it to happen again.


Actipro Software Support

Posted 12 years ago by P. O. - Inosoft GmbH
Avatar

Hello and thanks for you help.

Next time this happens, I will try out your solution and save the XML content of the Document.

Let's see how long it will take... Could be a few days or weeks ;)

 

Thanks for you help :)

Posted 12 years ago by P. O. - Inosoft GmbH
Avatar

Hello!

 

The problem has happened again. I saved the XML content of the SyntaxEditor and tried to reproduce the problem. That didn't work. It's just valid XML content.

I had a look at the threads a few seconds after editing in the document:

http://imageshack.us/photo/my-images/84/parser.png/

 

Where is the parser thread?

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

If it's running, you should see it as something like "ThreadedParseRequestDispatcher.Worker1".  Run your app again and break and see if you see it listed at all.  If not then perhaps you aren't using the multi-threaded features of SyntaxEditor?  If that is the case, please read through the add-ons Getting Started topic and follow the steps there to get it set up properly.


Actipro Software Support

The latest build of this product (v24.1.2) was released 9 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.