I have a List of SyntaxEditor objects. Each object's Document has the same Language assigned to it and all Documents' text is valid. The SemanticParserService is automatically invoked and parsing takes less than a second for all Documents. That is all a-ok.
Problem: I have a button in my application that, when pressed, makes a copy of all current SyntaxEditor objects (the code is below). When the SyntaxEditors' Document.Text members are assigned, the SemanticParserService is invoked (I verified this in debug). Parsing bogs down and MyDynamicSyntaxLanguage.PerformSemanticParse(...) never returns a CompilationUnit object. I can see that the first Document is being parsed and the SemanticParserServiceRequests are pending for all the other SyntaxEditors' Documents. The CPU Usage in Windows Task Manager is buried at 100%.
What in the world is causing this? Here is the code:
Problem: I have a button in my application that, when pressed, makes a copy of all current SyntaxEditor objects (the code is below). When the SyntaxEditors' Document.Text members are assigned, the SemanticParserService is invoked (I verified this in debug). Parsing bogs down and MyDynamicSyntaxLanguage.PerformSemanticParse(...) never returns a CompilationUnit object. I can see that the first Document is being parsed and the SemanticParserServiceRequests are pending for all the other SyntaxEditors' Documents. The CPU Usage in Windows Task Manager is buried at 100%.
What in the world is causing this? Here is the code:
List<SyntaxEditor> aSyntaxEditorCopies = new List<SyntaxEditor>();
foreach (SyntaxEditor oSyntaxEditorOriginal in this.aSyntaxEditorOriginals)
{
SyntaxEditor oSyntaxEditorCopy = new SyntaxEditor();
string strFileContents = oSyntaxEditorOriginal.Document.Text;
oSyntaxEditorCopy.Document.Text = strFileContents;
oSyntaxEditorCopy.Document.Language = this.oDSLanguage;
aSyntaxEditorCopies.Add(oSyntaxEditorCopy);
// Monitor the IsBusy flag.
// Without it, all CompilationUnits remain null and program crashes
while (SemanticParserService.IsBusy == true) { }
}