Issue with doing SelectedView.InsertText

SyntaxEditor for Windows Forms Forum

Posted 19 years ago by Ashton - Developer, Schema Solutions LLC
Avatar
I am getting the following exception:

"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"

At the following stack trace:

at System.Collections.ArrayList.get_Item(Int32 index)
at ActiproSoftware.SyntaxEditor.TokenCollection.get_Item(Int32 index)
at ActiproSoftware.SyntaxEditor.BracketHighlighting._2()
at ActiproSoftware.SyntaxEditor.EditorView._1(Object , SelectionEventArgs )
at ActiproSoftware.SyntaxEditor.Selection._1(SelectionEventArgs )
at ActiproSoftware.SyntaxEditor.Selection._1(Boolean )
at ActiproSoftware.SyntaxEditor.Selection._1(DocumentModificationEventArgs )
at ActiproSoftware.SyntaxEditor.SyntaxEditor._2(Object , DocumentModificationEventArgs )
at ActiproSoftware.SyntaxEditor.Document._1(DocumentModificationEventArgs )
at ActiproSoftware.SyntaxEditor.Document._2(DocumentModificationEventArgs )
at ActiproSoftware.SyntaxEditor.Document._1(DocumentModification )
at ActiproSoftware.SyntaxEditor.Document._1(DocumentModificationType , Int32 , Int32 , String )
at ActiproSoftware.SyntaxEditor.Document.UndoableInsert(DocumentModificationType type, Int32 offset, Int32 length, String text)
at ActiproSoftware.SyntaxEditor.EditorView._1(DocumentModificationType , String )
at ActiproSoftware.SyntaxEditor.EditorView._1(String
at ActiproSoftware.SyntaxEditor.EditorView.InsertText(String text)
at MYCODE

I am passing the following text to InsertText

"123 ashton\r\nselect\r\n"
ie.
editor.SelectedView.InsertText("123 ashton\r\nselect\r\n");

The only thing that might have been different wasa that I had just split the editor into 2 panes (one on top of the other) and the selected view was probably in the bottom pane. I also had made the following call immediately before doing the InsertText:

this.editor.SelectedView.Selection.SelectAll();

But other than it being 2 panes and doing a select all, all I was doing was calling InsertText so I'm not sure why I was getting this exception.

Also, in case it helps, this was the text before I did the SelectAll and then the InsertText:

"123\nashton\nSELECT\n\t\n"

Thanks,

Ashton

Comments (4)

Posted 19 years ago by Ashton - Developer, Schema Solutions LLC
Avatar
Also, after I got the above error, I pressed Ctrl+Z and got the same error again.

Thanks,

Ashton
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ashton,

I can't dupe it. Can you give me a sequence of code lines that I can paste into the sample app in response to a button click to show the problem? We'd like to do a maintenance release very soon so it would be great if you could send this over today. Thanks!


Actipro Software Support

Posted 19 years ago by Ashton - Developer, Schema Solutions LLC
Avatar
I can't dup it in the sample app (but I can dup it in my app)

I'm not sure why it would give the error on InsertText (or doing Undo after getting the exception).

Would this maybe be because of something in the language def???

I'll keep trying to dup it in the sample app.

Thanks,

Ashton
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Not sure but it would be best if you could dupe it in our sample app so that we can debug it on our end.


Actipro Software Support

The latest build of this product (v24.1.0) 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.