Radzen Multiple Dropdown Exception with search and keypress: Index was out of range

Hello,

I have this snippet in a new NET8 Blazor Project (Interactive Server)

@page "/test"
@rendermode @(new InteractiveServerRenderMode(prerender: false))
<h3>Testdropdown: </h3>

<RadzenDropDown @bind-Value=multipleValues Data=@customers Change="@OnChange"
                AllowFiltering="true" FilterCaseSensitivity="Radzen.FilterCaseSensitivity.CaseInsensitive"
                Name="DropDownMultipleChips"
                Multiple=true AllowClear=true Placeholder="Placeholder" AllowSelectAll="true"
                TextProperty="Text" ValueProperty="Value"
                Chips=true />

@code {
    IEnumerable<DropDownItem> customers;
    IEnumerable<string> multipleValues;

    protected override void OnInitialized()
    {
        customers = new List<DropDownItem>() { new DropDownItem("A", "1"), new DropDownItem("B", "2") };
    }

    void OnChange(object value)
    {
        var str = value is IEnumerable<object> ? string.Join(", ", (IEnumerable<object>)value) : value;

        Console.WriteLine($"Value changed to {str}");
    }
}

The search and selection works fine if I search with keyboard and click the option with a mouse. But when I filter and try to select an option with the arrow keys + enter, following exception is thrown:

warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
      Unhandled exception rendering component: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
      System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
         at System.Collections.Generic.List`1.get_Item(Int32 index)
         at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
         at Radzen.DropDownBase`1.HandleKeyPress(KeyboardEventArgs args, Boolean isFilter, Nullable`1 shouldSelectOnChange)
         at Radzen.DropDownBase`1.OnFilterKeyPress(KeyboardEventArgs args)
         at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
      Unhandled exception in circuit 'bmK_QszdTrY51bY_E17DwdRSE1NMcJ-ZPBm_RBkc2vw'.
      System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
         at System.Collections.Generic.List`1.get_Item(Int32 index)
         at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
         at Radzen.DropDownBase`1.HandleKeyPress(KeyboardEventArgs args, Boolean isFilter, Nullable`1 shouldSelectOnChange)
         at Radzen.DropDownBase`1.OnFilterKeyPress(KeyboardEventArgs args)
         at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
      Unhandled exception rendering component: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
      System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
         at System.Collections.Generic.List`1.get_Item(Int32 index)
         at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
         at Radzen.DropDownBase`1.HandleKeyPress(KeyboardEventArgs args, Boolean isFilter, Nullable`1 shouldSelectOnChange)
         at Radzen.DropDownBase`1.OnFilterKeyPress(KeyboardEventArgs args)
         at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
      Unhandled exception in circuit '1jMcUgNazoxC2hhsAGoUqC9U-03S29dIqz0NstlP4Es'.
      System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
         at System.Collections.Generic.List`1.get_Item(Int32 index)
         at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
         at Radzen.DropDownBase`1.HandleKeyPress(KeyboardEventArgs args, Boolean isFilter, Nullable`1 shouldSelectOnChange)
         at Radzen.DropDownBase`1.OnFilterKeyPress(KeyboardEventArgs args)
         at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Any idea how I can fix this or if I'm using something wrong?

Make sure you are using the latest version of Radzen.Blazor. Here is what I see in our demos:
dd-keypress-multi

Ah sorry... I really was some versions behind, the newest one fixes the exception and my main problem. Thanks!

But I still have an odd behaviour if you want to investigate (the second problem, the first must be something in my project then):

Error in my project:
If I search and select with the keys and press enter, nothing get's selected after a filter: only after I press the right arrow key.

Funny enough, I can't reproduce this exact behaviour on your demos but a similar one:

The items are not instantly deselectable with enter again in your demos - only if I press the right arrow key or the selection was once selected.

I use Firefox (and Firefox Developer) btw

Hi @Sonja !

I have the exact same behaviour (I have to press the right arrow key to get the item selected).
Did you manage to fix it ?

I'm using the last version of Radzen. It happens for every browser

I'll repeat my last post: