Exception in ActiproSoftware.Text.Wpf

SyntaxEditor for WPF Forum

Posted 12 years ago by Christel
Version: 11.2.0551
Platform: .NET 4.0
Environment: Windows 7 (32-bit)


I have a list of some views, each containing a syntaxeditor.

When switching between the views of the list, the editor is initialised with a new language and text and some new lexical patterns to verify.

Now we get an exception - not binded to a special item, just when switching to ione or another:


Object reference not set to an instance of an object.

at ActiproSoftware.Text.Lexing.Implementation.DynamicLexicalState.#EJ(ITextBufferReader reader)

at ActiproSoftware.Text.Lexing.Implementation.DynamicLexer.GetNextToken(ITextBufferReader reader, ILexicalState lexicalState)

at ActiproSoftware.Text.Lexing.Implementation.MergableLexerCoordinator.GetNextToken()

at ActiproSoftware.Text.Parsing.LLParser.Implementation.MergableTokenReader.GetNextToken()

at Gradient.WPF.Actipro.Controls.SyntaxEditor.MengenEditor.MengeTokenReader.GetNextToken()

protected override IToken GetNextToken()
	// Call the base method
	IToken token = base.GetNextToken();
	// Loop to skip over tokens that are insignificant to the parser
	while (!this.IsAtEnd)
		switch (token.Id)
			case MengeTokenId.Whitespace:
				// Skip
				token = base.GetNextToken();
				return token;
	return token;

 and the step before that could be


at ActiproSoftware.Text.Parsing.LLParser.Implementation.TokenReaderBase.GetLookAheadToken(Int32 count)


at ActiproSoftware.Text.Parsing.LLParser.Implementation.TokenReaderBase.Advance()

Have you any idea, which object in the ActiproSoftware.Text.Lexing.Implementation.DynamicLexicalState.#EJ(ITextBufferReader reader) could be null?


Comments (2)

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

Hi Christel,

That's the DynamicLexicalState.Match method, which is pretty complex.  Are you properly wrapping your lexer updates per the info in the "Text/Parsing Framework - Lexing / Basic Concepts" topic's "Changing Mergable Lexers" section?

If so we can debug it if you give us a very simple new sample project that shows it happening.

Actipro Software Support

Posted 12 years ago by Christel


I just sent you a sample project, which is not small but I hope, you'll get it and can start it.

While preparing it for you I realize some fact, which may cause the error:

The lexer of the LLParserFramework ha s a dynamic lexial pattern group, which is expanded up to 5000 entries of ecplicit patterns, after the syntax editor is initialized with the text to parse.

May be this could cause the match method to "struggle", especially if the next item with a syntaxeditor is selected and the editor again has to parse new text against this huge pattern list?

I don't want to write a programmatic lexer. Can such a huge list perhaps be validated in My TokenReader instead?

Thanks for looking at my example and answering the questions!

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

Add Comment

Please log in to a validated account to post comments.