thomasjo/highlight

Stackoverflow Exception

LucidaDragon opened this issue · 3 comments

`Private Highlighter As New Highlight.Highlighter(New Highlight.Engines.RtfEngine)

Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
    RichTextBox1.Rtf = Highlighter.Highlight("Python", RichTextBox1.Text)
End Sub`

Throws a stackoverflow exception when highlighter.highlight is called for the first time. Am I doing something wrong?

Would it be possible for you to share some example code that reproduces the problem? That would make it a lot easier for me to investigate, and hopefully fix the bug.

The code I posted above is the only code I had. To reproduce: Create a WinForm with a RichTextBox. In the form's code, construct a new Highlighter with the Rtf engine, then add an event handler for the RichTextBox's TextChanged event and use it to call Highlight("Python", RichTextBox1.Text)

When a character is entered into the RichTextBox, there is a huge menory spike before getting a stack overflow exception.