-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression with translation of Contains
for SqlServer
#32291
Comments
@AsgerPetersen have you tried the latest daily EF Core 8 build? https://github.com/dotnet/efcore/blob/main/docs/DailyBuilds.md - or EF Core 8.0.0 later today. |
@roji Confirmed that this still fails on latest daily build. |
@ErikEJ I think so and it failed. But it is my first time with daily builds, so I am not confident that I did it correctly. |
@AsgerPetersen - @ajcvickers was quick and just tested on latest daily, and it fails... |
I'll investigate this soon. In the meantime, as a workaround you can configure the SQL Server compatibility level as described here. |
Thank you for looking into this. Our SQLServer runs compatibility level 160 so we can´t turn it further up. If we go down to 120 (using this description) it throws this exception:
|
@roji This works on EF7:
But throws on EF8 even with the compat level set:
|
This turned out to be the same as #32217: nav expansion doesn't visit the item for (queryable) Contains. Making ProcessContains visit the item makes this work: private Expression ProcessContains(NavigationExpansionExpression source, Expression item)
{
source = (NavigationExpansionExpression)_pendingSelectorExpandingExpressionVisitor.Visit(source);
var queryable = Reduce(source);
var visitedItem = Visit(item);
return Expression.Call(QueryableMethods.Contains.MakeGenericMethod(queryable.Type.GetSequenceType()), queryable, visitedItem);
} Here's what's going on in more detail:
|
Duplicate of #32217 |
We have tried upgrading our production code to EfCore8 and we are seeing several failing tests. Seemingly caused by a regression in the translation of
Contains
in EfCore. The mitigations mentioned in the docs dont seem to work in our case.I have been through the other issues regaring
Contains
and I am not sure if this is a duplicate of any of those.This is a simple reproducer (here is a complete reproducing project with this code)
This works nicely with EfCore7 whereas EfCore 8 rc2 throws this exception:
Provider and version information
EF Core version: 8.0.0-rc.2.23480.1
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 8.0
Operating system: OSX
The text was updated successfully, but these errors were encountered: