Posted 20 years ago
by jsu2srv
- Boston, MA
(I am using version 2.5.0150 of SyntaxEditor and VS.NET 2003.)
Can someone tell me why this is happening? If I type a long method name in (that doesn't have a match in the IntelliPrompt MemberList control), and then select a member that is shorter than the text I typed, I get the following exception:
An unhandled exception of type 'System.ArgumentException' occurred in actiprosoftware.syntaxeditor.dll
Additional information: The offset '0' added to the length '24' must be less than or equal to the count of characters in the document.
My code is triggered on every key press in an identifier and looks like this:
private void ShowOptions(IntelliPromptMemberListItem[] options, int offset, int length)
{
if (editor.IntelliPrompt.MemberList.Visible)
return;
editor.IntelliPrompt.MemberList.Clear();
editor.IntelliPrompt.MemberList.AddRange(options);
editor.IntelliPrompt.MemberList.Show(offset, length);
}
If I type the following text into the editor:
asdfasfdasdfasdfasdfasdf
and then select the value "field" from the member list, I get the above exception.
Here is a full stack trace:
Unhandled Exception: System.ArgumentException: The offset '0' added to the length '24' must be less than or equal to the count of characters in the document.
at ActiproSoftware.SyntaxEditor.Document._2(Int32 , Int32 )
at ActiproSoftware.SyntaxEditor.Document.GetSubstring(Int32 offset, Int32 length)
at ActiproSoftware.SyntaxEditor.IntelliPromptMemberList.ActiproSoftware.SyntaxEditor.ISyntaxEditorEditModeHandler.OnSelectionChanged(SelectionEventArgs e)
at ActiproSoftware.SyntaxEditor.SyntaxEditor._1(SelectionEventArgs )
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.IntelliPromptMemberList._3()
at _9.OnHiding(EventArgs e)
at ActiproSoftware.WinUICore.PopupControl.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at ActiproSoftware.WinUICore.PopupControl.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at ActiproSoftware.WinUICore.PopupControl.SetVisibleCore(Boolean visible)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Control.Hide()
at ActiproSoftware.WinUICore.PopupControl.HidePopup()
at ActiproSoftware.SyntaxEditor.IntelliPromptMemberList.Complete()
at _9._2(Object , EventArgs )
at System.Windows.Forms.Control.OnDoubleClick(EventArgs e)
at System.Windows.Forms.ListBox.WndProc(Message& m)
at _8.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at RichExprEdit.Form1.Main() in s:\si\src\richexpredit\richexpredit\form1.cs:line 292The program '[4104] RichExprEdit.exe' has exited with code 0 (0x0).
Can someone tell me why this is happening? If I type a long method name in (that doesn't have a match in the IntelliPrompt MemberList control), and then select a member that is shorter than the text I typed, I get the following exception:
An unhandled exception of type 'System.ArgumentException' occurred in actiprosoftware.syntaxeditor.dll
Additional information: The offset '0' added to the length '24' must be less than or equal to the count of characters in the document.
My code is triggered on every key press in an identifier and looks like this:
private void ShowOptions(IntelliPromptMemberListItem[] options, int offset, int length)
{
if (editor.IntelliPrompt.MemberList.Visible)
return;
editor.IntelliPrompt.MemberList.Clear();
editor.IntelliPrompt.MemberList.AddRange(options);
editor.IntelliPrompt.MemberList.Show(offset, length);
}
If I type the following text into the editor:
asdfasfdasdfasdfasdfasdf
and then select the value "field" from the member list, I get the above exception.
Here is a full stack trace:
Unhandled Exception: System.ArgumentException: The offset '0' added to the length '24' must be less than or equal to the count of characters in the document.
at ActiproSoftware.SyntaxEditor.Document._2(Int32 , Int32 )
at ActiproSoftware.SyntaxEditor.Document.GetSubstring(Int32 offset, Int32 length)
at ActiproSoftware.SyntaxEditor.IntelliPromptMemberList.ActiproSoftware.SyntaxEditor.ISyntaxEditorEditModeHandler.OnSelectionChanged(SelectionEventArgs e)
at ActiproSoftware.SyntaxEditor.SyntaxEditor._1(SelectionEventArgs )
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.IntelliPromptMemberList._3()
at _9.OnHiding(EventArgs e)
at ActiproSoftware.WinUICore.PopupControl.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at ActiproSoftware.WinUICore.PopupControl.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at ActiproSoftware.WinUICore.PopupControl.SetVisibleCore(Boolean visible)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Control.Hide()
at ActiproSoftware.WinUICore.PopupControl.HidePopup()
at ActiproSoftware.SyntaxEditor.IntelliPromptMemberList.Complete()
at _9._2(Object , EventArgs )
at System.Windows.Forms.Control.OnDoubleClick(EventArgs e)
at System.Windows.Forms.ListBox.WndProc(Message& m)
at _8.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at RichExprEdit.Form1.Main() in s:\si\src\richexpredit\richexpredit\form1.cs:line 292The program '[4104] RichExprEdit.exe' has exited with code 0 (0x0).