OData / OData/AspNetCoreOData

InvalidOperationException on $apply query from EF Core

Open
#180 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

I am getting this expection on $apply query:
System.InvalidOperationException
HResult=0x80131509
Message=Processing of the LINQ expression 'GroupByShaperExpression:
KeySelector: new NoGroupByWrapper(),
ElementSelector:EntityShaperExpression:
EntityType: Student
ValueBufferExpression:
ProjectionBindingExpression: EmptyProjectionMember
IsNullable: False
' by 'RelationalProjectionBindingExpressionVisitor' failed. This may indicate either a bug or a limitation in Entity Framework. See https://go.microsoft.com/fwlink/?linkid=2101433 for more detailed information.
Source=Microsoft.EntityFrameworkCore.Relational

It is happening when I use $apply to query from ef core. Here is example of query:
https://localhost:44383/Student?$apply=aggregate($count as OrderCount)

Here is controller:

var query = MyDBContext.Set<Student>().AsQueryable();
var res = queryOptions.ApplyTo(query);

My project is in .NET 5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the $apply=aggregate($count as OrderCount) request and the controller's queryOptions.ApplyTo(query) call. Reproduce the InvalidOperationException against EF Core using the Student query, then determine whether the failure is a bug or a limitation and document the result or identify the affected query-processing path.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.