DataGrid CheckBoxList filter mode with EF Core data source crashes application when using keyboard controls #1596

Closed
opened 2026-01-29 17:55:51 +00:00 by claunia · 0 comments
Owner

Originally created by @Mvis2 on GitHub (Feb 4, 2025).

Describe the bug
When applying a FilterMode.CheckBoxList filter to an enum property in a Radzen Blazor DataGrid, the application throws an exception when navigating through the filter options using the SPACE or CONTROL keys on the keyboard.
This issue occurs exclusively when using Entity Framework (EF) Core as the data source. The issue does not manifest when using other data sources. A reproducible example has been set up in a forked repository: https://github.com/Mvis2/radzen-blazor

Exception details:

System.ArgumentException: Expression of type 'Microsoft.EntityFrameworkCore.InMemory.Query.Internal.InMemoryShapedQueryCompilingExpressionVisitor+QueryingEnumerable`1[RadzenBlazorDemos.Models.Northwind.Gender]' cannot be used for return type 'System.Collections.Generic.IEnumerable`1[System.Object]'
       at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type delegateType, Expression& body, ReadOnlyCollection`1 parameters, String paramName)
       at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, ParameterExpression[] parameters)
       at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutorExpression[TResult](Expression query)
       at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
       at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
       at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
       at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass11_0`1.<ExecuteCore>b__0()
       at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
       at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteCore[TResult](Expression query, Boolean async, CancellationToken cancellationToken)
       at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
       at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
       at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetEnumerator()
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at Radzen.DropDownBase`1.HandleKeyPress(KeyboardEventArgs args, Boolean isFilter, Nullable`1 shouldSelectOnChange) in C:\Users\MelvinS\source\repos\radzen-blazor\Radzen.Blazor\DropDownBase.cs:line 744
       at Radzen.DropDownBase`1.OnKeyPress(KeyboardEventArgs args, Nullable`1 shouldSelectOnChange) in C:\Users\MelvinS\source\repos\radzen-blazor\Radzen.Blazor\DropDownBase.cs:line 854
       at Radzen.Blazor.RadzenListBox`1.OnKeyDown(KeyboardEventArgs args) in C:\Users\MelvinS\source\repos\radzen-blazor\Radzen.Blazor\RadzenListBox.razor.cs:line 93
       at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
       at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

To Reproduce
Steps to reproduce the behavior:

  1. Go to the forked repository and clone it.
  2. Open the solution in an IDE and run the demo application.
  3. Navigate to the /datagrid page and load the IQueryable example.
  4. The example has been modified to include a new Gender enum filter.
  5. Click on the filter icon to open the checkbox filter list.
  6. Attempt to navigate the list using the SPACE or CONTROL keys.
  7. Observe that the application crashes with the reported exception.

Expected behavior
The application should not throw an exception when navigating the checkbox filter list with keyboard inputs. The filter should function correctly regardless of the data source being used. Additionally, it may be more intuitive to use the TAB key instead of SPACE for navigation, although this might be design choice.

Screenshots
Image

Desktop (please complete the following information):

  • OS: Windows 10 Enterprise 22H2
  • Browser: Google Chrome
  • Version 132.0.6834.111
  • Radzen Blazor Version: 5.9.6 (latest)

Let me know if additional details or logs are required to further diagnose this issue. Thanks!

Originally created by @Mvis2 on GitHub (Feb 4, 2025). **Describe the bug** When applying a `FilterMode.CheckBoxList` filter to an enum property in a Radzen Blazor `DataGrid`, the application throws an exception when navigating through the filter options using the `SPACE` or `CONTROL` keys on the keyboard. This issue occurs exclusively when using Entity Framework (EF) Core as the data source. The issue does not manifest when using other data sources. A reproducible example has been set up in a forked repository: https://github.com/Mvis2/radzen-blazor **Exception details:** ``` System.ArgumentException: Expression of type 'Microsoft.EntityFrameworkCore.InMemory.Query.Internal.InMemoryShapedQueryCompilingExpressionVisitor+QueryingEnumerable`1[RadzenBlazorDemos.Models.Northwind.Gender]' cannot be used for return type 'System.Collections.Generic.IEnumerable`1[System.Object]' at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type delegateType, Expression& body, ReadOnlyCollection`1 parameters, String paramName) at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, ParameterExpression[] parameters) at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutorExpression[TResult](Expression query) at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query) at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass11_0`1.<ExecuteCore>b__0() at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteCore[TResult](Expression query, Boolean async, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetEnumerator() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Radzen.DropDownBase`1.HandleKeyPress(KeyboardEventArgs args, Boolean isFilter, Nullable`1 shouldSelectOnChange) in C:\Users\MelvinS\source\repos\radzen-blazor\Radzen.Blazor\DropDownBase.cs:line 744 at Radzen.DropDownBase`1.OnKeyPress(KeyboardEventArgs args, Nullable`1 shouldSelectOnChange) in C:\Users\MelvinS\source\repos\radzen-blazor\Radzen.Blazor\DropDownBase.cs:line 854 at Radzen.Blazor.RadzenListBox`1.OnKeyDown(KeyboardEventArgs args) in C:\Users\MelvinS\source\repos\radzen-blazor\Radzen.Blazor\RadzenListBox.razor.cs:line 93 at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) ``` **To Reproduce** Steps to reproduce the behavior: 1. Go to the [forked repository](https://github.com/Mvis2/radzen-blazor) and clone it. 2. Open the solution in an IDE and run the demo application. 3. Navigate to the `/datagrid` page and load the `IQueryable` example. 4. The example has been modified to include a new `Gender` enum filter. 5. Click on the filter icon to open the checkbox filter list. 6. Attempt to navigate the list using the SPACE or CONTROL keys. 7. Observe that the application crashes with the reported exception. **Expected behavior** The application should not throw an exception when navigating the checkbox filter list with keyboard inputs. The filter should function correctly regardless of the data source being used. Additionally, it may be more intuitive to use the `TAB` key instead of `SPACE` for navigation, although this might be design choice. **Screenshots** ![Image](https://github.com/user-attachments/assets/21f3bb3c-098f-443b-a97e-8bdbb4df9c64) **Desktop (please complete the following information):** - OS: Windows 10 Enterprise 22H2 - Browser: Google Chrome - Version 132.0.6834.111 - Radzen Blazor Version: 5.9.6 (latest) Let me know if additional details or logs are required to further diagnose this issue. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1596