PavelTorgashov / FastColoredTextBox

Fast Colored TextBox for Syntax Highlighting. The text editor component for .NET.
Other
1.21k stars 463 forks source link

Red cross & System.ArgumentOutOfRangeException: Index was out of range. #210

Open nongcaro opened 4 years ago

nongcaro commented 4 years ago

image

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at FastColoredTextBoxNS.TextSource.get_Item(Int32 i) in C:\Users\nong\source\repos\editor\FastColoredTextBox\FastColoredTextBox\TextSource.cs:line 123
   at FastColoredTextBoxNS.FastColoredTextBox.get_Item(Int32 iLine) in C:\Users\nong\source\repos\editor\FastColoredTextBox\FastColoredTextBox\FastColoredTextBox.cs:line 1365
   at FastColoredTextBoxNS.TextStyle.Draw(Graphics gr, Point position, Range range) in C:\Users\nong\source\repos\editor\FastColoredTextBox\FastColoredTextBox\Style.cs:line 142
   at FastColoredTextBoxNS.FastColoredTextBox.FlushRendering(Graphics gr, StyleIndex styleIndex, Point pos, Range range) in C:\Users\nong\source\repos\editor\FastColoredTextBox\FastColoredTextBox\FastColoredTextBox.cs:line 5509
   at FastColoredTextBoxNS.FastColoredTextBox.DrawLineChars(Graphics gr, Int32 firstChar, Int32 lastChar, Int32 iLine, Int32 iWordWrapLine, Int32 startX, Int32 y) in C:\Users\nong\source\repos\editor\FastColoredTextBox\FastColoredTextBox\FastColoredTextBox.cs:line 5469
   at FastColoredTextBoxNS.FastColoredTextBox.OnPaint(PaintEventArgs e) in C:\Users\nong\source\repos\editor\FastColoredTextBox\FastColoredTextBox\FastColoredTextBox.cs:line 5163
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.UserControl.WndProc(Message& m)
   at FastColoredTextBoxNS.FastColoredTextBox.WndProc(Message& m) in C:\Users\nong\source\repos\editor\FastColoredTextBox\FastColoredTextBox\FastColoredTextBox.cs:line 2943
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

what is happening...?

nongcaro commented 4 years ago

When I have document map on:

image

It goes to the document map instead. wtf?

nongcaro commented 4 years ago

It happens most of the times, 50% chance to happen when I start the editor.

harethmohammed commented 4 years ago

This library is outdated, last update is 11 months ago

hlk9 commented 4 years ago

humm, i think you need to set target for document map, documentMap1.Target=fascoloredTextBox set FCTB and DocumentMap to Individual Panel and set the Dock property to "Fill", I think so but not sure

RedDot-3ND7355 commented 3 years ago

This is a really annoying issue. And still occurs on latest version. There's no handler for that type of error and the control only needs a complete redraw and it's fixed.