Skip to content

Better error when trying to use EF.Constant/Parameter with compiled queries and query filters #38151

@roji

Description

@roji

We currently throw a cryptic:

System.InvalidCastException: Unable to cast object of type 'System.Linq.Expressions.ConstantExpression' to type 'Microsoft.EntityFrameworkCore.Query.QueryParameterExpression'.

See #33674 for the original change in the EF.Constant/Parameter implementation that introduced the incompatibility with compiled queries; and #38150 for a recent report triggering this issue.

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions