The 'DateDiffDay' method is not supported because the query has switched to client-evaluation.
See original GitHub issueAfter updating our package references to
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.0-rc.1.20451.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0-rc.1.20451.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0-rc.1.20451.13">
Some of our queries which contain EF.Functions.DateDiffDay then fail when being tested against our InMemory database with the error message
Error Message:
System.InvalidOperationException : The ‘DateDiffDay’ method is not supported because the query has switched to client-evaluation. Inspect the log to determine which query expressions are triggering client-evaluation.
Stack Trace:
at Microsoft.EntityFrameworkCore.SqlServerDbFunctionsExtensions.DateDiffDay(DbFunctions _, DateTime startDate, DateTime endDate)
at lambda_method13273(Closure , ValueBuffer )
at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext() at Microsoft.EntityFrameworkCore.InMemory.Query.Internal.InMemoryShapedQueryCompilingExpressionVisitor.QueryingEnumerable1.Enumerator.MoveNextHelper()
at Microsoft.EntityFrameworkCore.InMemory.Query.Internal.InMemoryShapedQueryCompilingExpressionVisitor.QueryingEnumerable1.Enumerator.MoveNextAsync() at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable1.Enumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToArrayAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
Could you confirm if EF.Functions.DateDiffDay should be available when using the InMemory provider?
Further technical details
EF Core version: Database provider: (e.g. Microsoft.EntityFrameworkCore.InMemory) Target framework: (e.g. .NET 5.0 rc1) Operating system: Windows 10 IDE: dotnet test
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (8 by maintainers)
Top Related StackOverflow Question
@mikeroque - Please file a new issue with runnable repro code.
@ajcvickers https://github.com/dotnet/EntityFramework.Docs/pull/2651