-
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
.Set<> then .Any() fails after second time with .NET 6.0.100-rc.1.21458.32 / Microsoft.EntityFrameworkCore.SqlServer 6.0.0-rc.1.21452.10 #26167
Comments
Pollution of FromSqlParameterExpandingExpressionVisitor. Perhaps empty parameter list is throwing off the logic. |
@smitpatel and/or @roji Can one of you take a look at this for 6.0. |
Issue is that the SelectExpression with FromSql doesn't have any projection so we in-place mutate and the cache is polluted with modification. Our logic for in-place mutation is dependent on projection atm. Changing that logic could be risky. A way to fix without changing current logic would involve putting a hack with new internal API to avoid in-place mutation. |
Note from triage: we should at least throw better exception and point to workaround if other options are too risky for 6.0. |
#26532 will resolve this. |
…pplied - Add an internal state to remember the mutability which is set to false after ApplyProjection is called. - Add overload of ApplyProjection which ignores shaper to create an immutable select expression to be used as subquery - Add debug check to verify that all SelectExpression are marked as immutable - Clone mapped projection of SqlExpression kind before translating it further to avoid reference sharing with projection which may be applied at later stage Resolves #26532 - all those expressions have debug check in ctor Resolves #26167 - by having more accurate flag for immutability Resolves #26104 - by cloning the projection before translating further. This issue may get resolved in other way after pending selector work if we reuse projections from subquery but regardless the change seems better to avoid reference sharing of SelectExpression objects
…pplied - Add an internal state to remember the mutability which is set to false after ApplyProjection is called. - Add overload of ApplyProjection which ignores shaper to create an immutable select expression to be used as subquery - Add debug check to verify that all SelectExpression are marked as immutable - Clone mapped projection of SqlExpression kind before translating it further to avoid reference sharing with projection which may be applied at later stage Resolves #26532 - all those expressions have debug check in ctor Resolves #26167 - by having more accurate flag for immutability Resolves #26104 - by cloning the projection before translating further. This issue may get resolved in other way after pending selector work if we reuse projections from subquery but regardless the change seems better to avoid reference sharing of SelectExpression objects
…pplied - Add an internal state to remember the mutability which is set to false after ApplyProjection is called. - Add overload of ApplyProjection which ignores shaper to create an immutable select expression to be used as subquery - Add debug check to verify that all SelectExpression are marked as immutable Resolves #26532 - all those expressions have debug check in ctor Resolves #26167 - by having more accurate flag for immutability
…pplied - Add an internal state to remember the mutability which is set to false after ApplyProjection is called. - Add overload of ApplyProjection which ignores shaper to create an immutable select expression to be used as subquery - Add debug check to verify that all SelectExpression are marked as immutable Resolves #26532 - all those expressions have debug check in ctor Resolves #26167 - by having more accurate flag for immutability
…pplied (#27011) - Add an internal state to remember the mutability which is set to false after ApplyProjection is called. - Add overload of ApplyProjection which ignores shaper to create an immutable select expression to be used as subquery - Add debug check to verify that all SelectExpression are marked as immutable Resolves #26532 - all those expressions have debug check in ctor Resolves #26167 - by having more accurate flag for immutability
DbContext.Set<>() .FromSql(). Any() will fail after second time with .NET 6 RC1 and EFCore SqlServer 6.0.0-rc.1.21452.10.
It will no issue with .NET 5 and EFCore 5.0.10 with no code change.
To reproduce:
Exception and Stack Trace
EF Core version: 6.0.0-rc.1.21452.10
Database provider: Microsoft.EntityFrameworkCore.SqlServer 6.0.0-rc.1.21452.10
Database: SQL Server 12.0.2000.8 (Azure SQL Database )
Target framework: .NET 6.0.100-rc.1.21458.32
Operating system: Windows 10
The text was updated successfully, but these errors were encountered: