Completed
Last Updated: 24 Nov 2021 12:40 by ADMIN
Andy
Created on: 07 Oct 2020 08:13
Category: Grid
Type: Bug Report
7
Grouping does not work using IQueriable (EF Core provided data)

I am using EF on my backend and when I group I get an error like this one:

Unhandled exception rendering component: Processing of the LINQ expression '(GroupByShaperExpression:
      KeySelector: (t.FirstName), 
      ElementSelector:(EntityShaperExpression: 
          EntityType: Customer
          ValueBufferExpression: 
              (ProjectionBindingExpression: EmptyProjectionMember)
          IsNullable: False
      )
      )' by 'RelationalProjectionBindingExpressionVisitor' failed. This may indicate either a bug or a limitation in EF Core. See https://go.microsoft.com/fwlink/?linkid=2101433 for more detailed information.
System.InvalidOperationException: Processing of the LINQ expression '(GroupByShaperExpression:
KeySelector: (t.FirstName), 
ElementSelector:(EntityShaperExpression: 
    EntityType: Customer
    ValueBufferExpression: 
        (ProjectionBindingExpression: EmptyProjectionMember)
    IsNullable: False
)
)' by 'RelationalProjectionBindingExpressionVisitor' failed. This may indicate either a bug or a limitation in EF Core. See https://go.microsoft.com/fwlink/?linkid=2101433 for more detailed information.
   at Microsoft.EntityFrameworkCore.Query.Internal.RelationalProjectionBindingExpressionVisitor.VisitExtension(Expression extensionExpression)
   at System.Linq.Expressions.Expression.Accept(ExpressionVisitor visitor)

 

and a lot more line through the EF Core expression classes.

-----

ADMIN EDIT

At the moment, it looks like there is an issue between EF, LINQ and GroupBy expressions that seems to be the origin of this. In a profiler, you can see that running a group expression does not even run a query against the database itself - this is the origin of the problem, and the subsequent paging operation is where an actual exception is thrown, but it points to the field that was used for grouping.

Considering that grouping has to pull all the data anyway, materializing the data from an IQueriable to an IEnumerable should solve the issue, even though it can be a performance hit - for relatively small data sets it may not be a significant problem.

    protected override void OnInitialized()
    {
        GridData = ProductService.GetProducts().ToList();
    }

 

----

2 comments
ADMIN
Marin Bratanov
Posted on: 18 Feb 2021 13:05

Hello Daniel,

A tentative plan for making the source code available to commercial license holders is November. Whether that will include the DataSource package is yet to be determined.

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Liero
Posted on: 18 Feb 2021 07:37

Wait a moment...

Considering that grouping has to pull all the data anyway

Why is that? If I use paging, or LoadGroups on demand, there is no reason to load all the groups.

 

Would you consider open sourcing this extension method?