Crash in code completion popup if class and namespace with same name

Hi,
I have uploaded a modified "SnippetParsers" sample at https://www.hg-online.de/downloads/SnippetsParsers_2020-09-11.zip
To reproduce the crash:
1) switch to "Visual Basic" and "Method".
2) Then delete the code editor text and enter:
"dim a as Dat"
=>code completion pops up, and you will see a class "Date" and a namespace "Date".
3) Now type "e" to complete the word "Date" => this crash occurs:
System.ArgumentOutOfRangeException: Der Index lag außerhalb des Bereichs. Er darf nicht negativ und kleiner als die Sammlung sein.
Parametername: index
bei System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
bei System.Collections.Generic.List`1.get_Item(Int32 index)
bei Alternet.Editor.CodeCompletion.CompletionListBox.OnDrawItem(DrawItemEventArgs e)
bei System.Windows.Forms.ListBox.WmReflectDrawItem(Message& m)
bei System.Windows.Forms.ListBox.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
The sample adds a class "SomeTest" in package "Date" and registers the current assembly "SnippetsParser.exe" in the VbParser.Repository.

I am still stuck at version 6.0 because our license expired.
Best regards
Wolfgang
Hello Wolfgang,
Thank you for providing the project that shows the problem. It was fixed in 6.2 and you still can use 6.2 with your license (as 6.2 was a minor update for version 6).
Alternatively you can fix the problem by subclassing from SyntaxEdit and overriding CreateCodeCompletionBox method like this:
public class MySyntaxEdit : SyntaxEdit
{
public MySyntaxEdit(System.ComponentModel.IContainer container)
: base(container)
{
}
protected override ICodeCompletionBox CreateCodeCompletionBox()
{
return new MyCodeCompletionBox(this);
}
}
public class MyCodeCompletionBox : CodeCompletionBox
{
public MyCodeCompletionBox(Control owner)
: base(owner)
{
}
protected override ICompletionListBox CreateCodeCompletionListBox()
{
return new MyCompletionListBox();
}
}
public class MyCompletionListBox : CompletionListBox
{
protected override bool IsFiltered(int itemIndex, out ItemFilterTextMatch filterTextMatch)
{
return IsFiltered(Provider.GetName(itemIndex), Provider.GetPriority(itemIndex), out filterTextMatch);
}
}
Regards,
Andrew
Thanks, I can confirm that it works with 6.2
Best regards
Wolfgang