DataGrid filtering on nullable string column will throw ReferenceNullException #1620

Open
opened 2026-01-29 17:56:21 +00:00 by claunia · 0 comments
Owner

Originally created by @Anspitzen on GitHub (Feb 17, 2025).

Describe the bug
Filtering on a Column with a nullable string property will cause a Linq ReferenceNullException, crashing the site

To Reproduce
Steps to reproduce the behavior:

  1. Go to a Radzen Blazor demo page
  2. Replace the Source with
@using RadzenBlazorDemos.Models.Northwind

<RadzenDataGrid AllowFiltering="true"
                FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
                FilterMode="FilterMode.Simple"
                        Data="@employees">
    <Columns>
        <RadzenDataGridColumn Property="@nameof(Employee.FirstName)" Title="First Name" />

        <RadzenDataGridColumn Property="@nameof(Employee.LastName)" Title="Last Name"
                 Type="typeof(string)"  >
        </RadzenDataGridColumn>
    </Columns>
</RadzenDataGrid>

@code {
    IList<Employee> employees = new List<Employee>();

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();
        employees.Add(new Employee{
            FirstName = "Maria",
            LastName = "1"
        });
        employees.Add(new Employee{
            FirstName = "Aria",
            LastName = ""
        });
        employees.Add(new Employee{
            FirstName = "aria",
            LastName = null
        });
        employees.Add(new Employee{
            FirstName = "ian"
        });
    }
}
  1. Run and try to filter for Last Name
  2. See error

Expected behavior
Filter should still work like previous, filtering where string not null

Additional context
Did some tests, in v5.9.9 it did still work, but in the v6.0.0 it got the breaking change on that filtering behaviour

Originally created by @Anspitzen on GitHub (Feb 17, 2025). **Describe the bug** Filtering on a Column with a nullable string property will cause a Linq ReferenceNullException, crashing the site **To Reproduce** Steps to reproduce the behavior: 1. Go to a Radzen Blazor demo page 2. Replace the Source with ``` @using RadzenBlazorDemos.Models.Northwind <RadzenDataGrid AllowFiltering="true" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterMode="FilterMode.Simple" Data="@employees"> <Columns> <RadzenDataGridColumn Property="@nameof(Employee.FirstName)" Title="First Name" /> <RadzenDataGridColumn Property="@nameof(Employee.LastName)" Title="Last Name" Type="typeof(string)" > </RadzenDataGridColumn> </Columns> </RadzenDataGrid> @code { IList<Employee> employees = new List<Employee>(); protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); employees.Add(new Employee{ FirstName = "Maria", LastName = "1" }); employees.Add(new Employee{ FirstName = "Aria", LastName = "" }); employees.Add(new Employee{ FirstName = "aria", LastName = null }); employees.Add(new Employee{ FirstName = "ian" }); } } ``` 3. Run and try to filter for Last Name 4. See error **Expected behavior** Filter should still work like previous, filtering where string not null **Additional context** Did some tests, in v5.9.9 it did still work, but in the v6.0.0 it got the breaking change on that filtering behaviour
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1620