The 'DateDiffDay' method is not supported because the query has switched to client-evaluation.

See original GitHub issue

After 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:closed
  • Created 3 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
smitpatelcommented, Oct 23, 2020

@mikeroque - Please file a new issue with runnable repro code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The 'Collate' method is not supported because the query ...
When I try to test this method , i have this error : "The 'Collate' method is not supported because the query has...
Read more >
Client vs. Server Evaluation - EF Core
Unsupported client evaluation. While client evaluation is useful, it can result in poor performance sometimes. Consider the following query, in ...
Read more >
EF Core Client Side evaluation (and how to stop it)
But the best first step is disabling client side evaluation, the following code on the DbContext changes the drop from server to client...
Read more >
Entity Framework Core: Client vs. Server evaluation
What happens is that EF Core converts the query into SQL to run on the database, but one method, string.Join, isn't supported as...
Read more >
Ooze.Typed.EntityFrameworkCore.SqlServer 1.0.68
System.InvalidOperationException : The 'Like' method is not supported because the query has switched to client-evaluation. This usually happens ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found