
I am currently evaluating the SyntaxEditing component, and have encountered a problem while attempting to manually issue a parse request to the AmbientParseRequestDispatcherProvider outside the context of the syntax editor.
I initially encountered this problem with our own Irony Grammar, but have replicated the problem using the IronyIntegration example project which uses the SimpleLanguageGrammar.
IParseRequest request = new ParseRequest(UniqueId.ToString(), new StringTextBufferReader("function Add(x, y) { return x + y; }"), _language, this)
{
Priority = ParseRequest.LowPriority,
};
if (AmbientParseRequestDispatcherProvider.Dispatcher != null)
{
AmbientParseRequestDispatcherProvider.Dispatcher.QueueRequest(request);
AmbientParseRequestDispatcherProvider.Dispatcher.WaitForParse(request.ParseHashKey);
}
When I run this code, I get the following error during the WaitForParse():
System.NullReferenceException was unhandled
Message: An unhandled exception of type 'System.NullReferenceException' occurred in ActiproSoftware.Text.Addons.Irony.Wpf.dll
Additional information: Object reference not set to an instance of an object.
I can call the language parser directly without problem, ie
parseData = (IIronyParseData) _language.Parse("function Add(x, y) { return x + y; }");
This works perfectly and returns exactly what I would expect. Am I doing something obviously wrong?
[Modified 11 years ago]