Posted 19 years ago by Ashton - Developer, Schema Solutions LLC
I am getting the following exception at random intervals in my application:

Top Level Exception
Type: System.ArgumentOutOfRangeException
Message: Index was out of range. Must be non-negative and less than
the size of the collection.
Parameter name: index
Source: mscorlib
Stack Trace: at System.Collections.ArrayList.get_Item(Int32 index)
at ActiproSoftware.SyntaxEditor.TokenCollection.get_Item(Int32 index)
at ActiproSoftware.SyntaxEditor.TokenCollection._1(Int32 , Int32 )
at ActiproSoftware.SyntaxEditor.EditorView._1(Graphics , Rectangle ,
DocumentLine , Int32 , DisplayLine , _37 , Rectangle , Int32 )
at ActiproSoftware.SyntaxEditor.EditorView._2(Graphics , Rectangle )
at ActiproSoftware.SyntaxEditor.EditorView.OnRender(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIElement.Render(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIControl.Render(PaintEventArgs e)
at ActiproSoftware.WinUICore.UIControl._1(PaintEventArgs )
at ActiproSoftware.WinUICore.UIControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs
e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at ActiproSoftware.SyntaxEditor.SyntaxEditor.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

After I get this exception, the location where the editor portion of the control is turns to a big red X (I've gotten this before when I have exception in paint event in my own controls).

I am not sure what is going on since this seems to be a callback to the editor control (to probably repaint the editor), but it looks like something might be changed during painting causing this error???

Any ideas what might cause this and how I might correct or avoid it?


Comments (1)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Are you doing any Application.DoEvents that could possibly be causing the token state at paint time to not match the real token state, thereby allowing an exception like this to happen?

If you can duplicate it for us in the sample app, please let us know so we can debug it and get it fixed if there is a problem on our end.

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.