We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

System.NullReferenceException: 'Object reference not set to an instance of an object when filter result is not found

I get a Error: System.NullReferenceException: 'Object reference not set to an instance of an object

when result is empty.

I use Syncfusion.Blazor.Grids.FilterType.CheckBox

@page "/klantenlijst"

@using Simar.Web.Services

@using Simar.Web.Models

@using Syncfusion.Blazor.Buttons

@using Syncfusion.Blazor.Grids

@inject INawService NawService


<br />

<div id="ControlRegion" style="height:calc(100vh - 13rem);">

    <SfGrid ID="Grid" DataSource="@naw" @ref="Grid" AllowPaging="false" AllowFiltering="true" AllowReordering="true" AllowResizing="true" AllowPdfExport="true"

            AllowGrouping="true" AllowExcelExport="true" AllowSelection="true" EnableStickyHeader="true"

            AllowSorting="true" Toolbar="@(new List<string>() {"CsvExport","PdfExport", "ExcelExport","Search"})" Height="100%" Width="100%" EnableVirtualization="true">

        <GridEditSettings AllowAdding="false" AllowEditing="false" AllowDeleting="false" Mode="EditMode.Dialog"></GridEditSettings>

        <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.CheckBox" ShowFilterBarStatus="true" EnableCaseSensitivity="false"></GridFilterSettings>

        <GridPageSettings PageSizes="false"></GridPageSettings>



                <span>Er zijn geen gevens on te tonen</span>



        <GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Single"></GridSelectionSettings>


            <GridColumn Field=@nameof(Naw.RelatieNr) HeaderText="Relatie nr." IsPrimaryKey="true" ValidationRules="@(new ValidationRules{ Required=true })" TextAlign="TextAlign.Right" Width="120"></GridColumn>

            <GridColumn Field=@nameof(Naw.Naam) HeaderText="Naam" Width="120"></GridColumn>

            <GridColumn Field=@nameof(Naw.Adres) HeaderText="Adres" Width="120"></GridColumn>

            <GridColumn Field=@nameof(Naw.PC) HeaderText="Postcode" Width="120"></GridColumn>

            <GridColumn Field=@nameof(Naw.Woonplaats) HeaderText="Woonplaats" Width="120"></GridColumn>

            <GridColumn Field=@nameof(Naw.EMail) HeaderText="Email" Width="120"></GridColumn>

            <GridColumn Field=@nameof(Naw.Telefoon3) HeaderText="Telefoon" Width="120"></GridColumn>

            <GridColumn Field=@nameof(Naw.Telefoon4) HeaderText="Telefoon" Width="120"></GridColumn>

            <GridColumn Field=@nameof(Naw.MobielNr1) HeaderText="Mobiel" Width="120"></GridColumn>

            <GridColumn Field=@nameof(Naw.MobielNr2) HeaderText="Mobiel" Width="120"></GridColumn>





    .ulstyle {

        margin: 0px;

        padding-left: 20px;

        display: inline-block;


    .list {

        float: left;

        line-height: 20px;

        margin: 10px;

        min-width: 200px;


    .btn-cls {

        margin: 0px 5px 10px 5px;



@code {

    public IQueryable<Naw> naw { get; set; }

    SfGrid<Naw>? Grid;

    protected override Task OnInitializedAsync()


        naw = NawService.GetNaw().Result;

        return base.OnInitializedAsync();


    public void ToolbarClick(Syncfusion.Blazor.Navigations.ClickEventArgs args)


        if (args.Item.Id == "Grid_excelexport")




        if (args.Item.Id == "Grid_pdfexport")




        if (args.Item.Id == "Grid_csvexport")






4 Replies

VN Vignesh Natarajan Syncfusion Team October 26, 2022 07:12 AM

Hi Antonio,

Greetings from Syncfusion support.

Query: “I get a Error: System.NullReferenceException: 'Object reference not set to an instance of an object when result is empty.”

We are able to reproduce the reported issue at our end while preparing the sample as per your code example. Currently, we are validating the reported issue further at our end and we need some more time to find the cause of the issue. So we will update you the further details by 28th October 2022.

Please get back to us if you have further queries.


Vignesh Natarajan

AM Antonio Martino October 26, 2022 07:33 AM

I notice that this only goes wrong with an IQueryable if I convert this to List then this doesn't happen.

Now I don't know what DataSource is doing here, otherwise I could have intervened.

I also don't know if the filtering actually uses the IQueryable Linq.

Furthermore, I use Couchbase as a database, here too there may be a reason that he handles this differently than, for example, MSSQL.

MS Monisha Saravanan Syncfusion Team October 27, 2022 09:30 AM

Hi Antonio,

Thanks for the update.

We are currently validating your query at our end. We will update further details within two business days on or before 31st October, 2022.

Until then we appreciate your patience.



MS Monisha Saravanan Syncfusion Team November 1, 2022 10:23 AM

Hi Antonio,

Thanks for the patience.

We have considered it as a bug and logged an issue  “Exception throws when filtered results are empty while using AsQueryable DataSource” for the same. Thank you for taking time to report this issue and helping us to improve our product. At Syncfusion, we are committed to fix all validated defects (subject to technological feasibility and Product Development Life Cycle) and this fix will be included in our upcoming patch release which is expected to be rolled out on or before 29th  November, 2022.

You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.       


Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization”

Until then we appreciate your patience.



Live Chat Icon For mobile
Up arrow icon