You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading from Entity Framework Core 5.0 to v6.0, I get an ArgumentOutOfRangeException error when executing a query with a Projection on a DbContext that contains a Query Filter on a nullable property:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')\r\n at
Microsoft.EntityFrameworkCore.Query.SqlExpressions.SelectExpression.GetProjection(ProjectionBindingExpression projectionBindingExpression)\r\n at
Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.VisitBinary(BinaryExpression binaryExpression)\r\n at
System.Dynamic.Utils.ExpressionVisitorUtils.VisitBlockExpressions(ExpressionVisitor visitor, BlockExpression block)\r\n at
System.Linq.Expressions.ExpressionVisitor.VisitBlock(BlockExpression node)\r\n at
Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.VisitExtension(Expression extensionExpression)\r\n at
System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes)\r\n at
System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node)\r\n at
Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.ProcessShaper(Expression shaperExpression, RelationalCommandCache& relationalCommandCache, LambdaExpression& relatedDataLoaders, Int32& collectionId)\r\n at
Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.VisitShapedQuery(ShapedQueryExpression shapedQueryExpression)\r\n at
Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.VisitExtension(Expression extensionExpression)\r\n at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)\r\n at
Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)\r\n at
Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)\r\n at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass12_0`1.<ExecuteAsync>b__0()\r\n at
Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)\r\n at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken)\r\n at
Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)\r\n at
Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetAsyncEnumerator(CancellationToken cancellationToken)\r\n at
System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1.GetAsyncEnumerator()\r\n at
Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
Provider and version information
EF Core version: 6.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: e.g. .NET 6.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.0.1
The text was updated successfully, but these errors were encountered:
@marcominerva Thanks for following up. This looks to be a duplicate of #26428, which is fixed ready for the 6.0.1 release. Your code no longer throws for me when using the 7.0.0-alpha.1.21573.2 daily build.
After upgrading from Entity Framework Core 5.0 to v6.0, I get an
ArgumentOutOfRangeException
error when executing a query with a Projection on a DbContext that contains a Query Filter on a nullable property:modelBuilder.Entity<Person>().HasQueryFilter(e => e.IsDeleted == null || !e.IsDeleted.Value);
I have created a small project to reproduce the issue here: https://github.com/marcominerva/QueryFilterProblem. In the README.md of the repository I have written where to search for the lines that cause the problem.
Stack trace
Provider and version information
EF Core version: 6.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: e.g. .NET 6.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.0.1
The text was updated successfully, but these errors were encountered: