NullReferenceExceptions in BlazorAdaptor.DataOperationInvoke<T> when Filtering with Menu over dynamic DataSource

Dear support,

we are using an SfGrid displaying data from a dynamic DataSource in Sf Blazor ver. 18.2.0.56. Dynamic DataSource means we bind a List<DynamicEntity>, where DynamicEntity is Derived from System.Dynamic.DynamicObject and implementing IDynamicMetaObjectProvider.

After binding, we dynamically build the columns of the grid by iterating over the DynamicObject's Properties.

This all works flawlessly, including pagination, export, etc.; The grid is inserted into a component like this:

        <SfGrid @ref="@DataGrid" DataSource="@AccessableEntities" TValue="SelectableDynamicEntity" AllowSelection="true" AllowPaging="true">
            <GridSelectionSettings Type="SelectionType.Single" Mode="SelectionMode.Row" EnableToggle="false"></GridSelectionSettings>
            <GridEvents RowSelected="HandleSfSelectionChange" OnRecordDoubleClick="HandleSfRowDoubleClick" TValue="SelectableDynamicEntity"></GridEvents>
            <GridColumns>
                <GridColumn Field="ID" IsPrimaryKey="true" Visible="false" />
                @foreach (var objCol in ColDefs)
                {
                    <GridColumn Field="@objCol.Field" HeaderText="@objCol.Caption" AllowSorting="@objCol.AllowSort" />
                }
            </GridColumns>
        </SfGrid>

But, problems arise when trying to enable filtering the Grid. Adding 'AllowFiltering="true"' to the SfGrid, and

               <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu" ShowFilterBarStatus="true" />

as well as per column:

               <GridColumn Field="@objCol.Field" HeaderText="@objCol.Caption" AllowFiltering="@objCol.AllowFilter" AllowSorting="@objCol.AllowSort" />

Causes an exception like the following as soon as the user opens the Filter Menu of a column:

    Syncfusion.Blazor.Data.EnumerableOperation.GetColumnType(System.Collections.IEnumerable, string, System.Type)
    Syncfusion.Blazor.Data.EnumerableOperation.PredicateBuilder(System.Collections.IEnumerable, System.Collections.Generic.List<Syncfusion.Blazor.Data.WhereFilter>, string, System.Linq.Expressions.ParameterExpression, System.Type)
    Syncfusion.Blazor.Data.EnumerableOperation.PerformFiltering(System.Collections.IEnumerable, System.Collections.Generic.List<Syncfusion.Blazor.Data.WhereFilter>, string)
    Syncfusion.Blazor.Data.BlazorAdaptor.DataOperationInvoke<T>(System.Collections.IEnumerable, Syncfusion.Blazor.DataManagerRequest)
    Syncfusion.Blazor.Data.BlazorAdaptor.PerformDataOperation.AnonymousMethod__0()
    System.Threading.Tasks.Task<TResult>.InnerInvoke()
    System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, object)
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

I already tried to add a custom DataAdaptor instead of the builtin BlazorAdaptor into the grid like the following, to aid our debugging:

        <SfGrid @ref="@DataGrid" TValue="SelectableDynamicEntity" AllowSelection="true" AllowFiltering="true" AllowPaging="true">
            <SfDataManager Json=@AccessableEntities Adaptor="Adaptors.CustomAdaptor" DataAdaptor="MyDataAdaptor"></SfDataManager>
             ...
         </SfGrid>

But unfortunately, even doing so, and even although the grid itself is correctly using the new Adaptor, the FilteringMenu still uses the default BlazorAdaptor in its PerformFiltering operation (I assume it is doing so while populating the search-as-you-type suggestions inside the FilterMenu).


My question now:

What must I ensure to make the Filtering work with a DynamicObject DataSource? Must I implement a custom DataAdaptor? If so, how can I ensure this is always used? Or, do I NOT need to implement a custom Adaptor, but must I ensure some prerequisites in the DynamicObject class, aside implementing IDynamicMetaObjectProvider?


Any help is greatly appreciated.

Regards,
Tim


1 Reply

JP Jeevakanth Palaniappan Syncfusion Team September 24, 2020 03:33 PM UTC

Hi Tim, 

Greetings from Syncfusion support. 

We have validated your query and we are able to reproduce the reported issue at our end. So we have considered it as a bug and logged the defect report “Null reference exception throws while filtering dynamic data” for the same. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our volume 3 main release which is expected to be rolled out by the end of September 2020. 
    
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.    


Until then we appreciate your patience. 

Regards, 
Jeevakanth SP. 


Loader.
Up arrow icon