-
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
Split query with AsNoTrackingWithIdentityResolution() throws ArgumentOutOfRangeException #34728
Comments
Confirmed regression in 9.0, specifically for AsNoTrackingWithIdentityResolution(). @maumar interested in taking a look? I think we'd consider this for servicing. |
Error is caused by a bug in JsonCorrectOrderOfEntitiesForChangeTrackerValidator, specifically it uses the initial SelectExpression to analyze structure of various shaper expressions in the query. Problem is that RelationalSplitCollectionShaperExpression has its own SelectExpression that desribed the collection - we should use that select expression rather than the parent |
Thanks for investigating @maumar! Note that this is a regression (bug didn't happen in 8.0 AFAICT), any idea of the change that triggered this? In any case, we should consider prioritizing this as a regression, even though it's somewhat edge-casey, requiring both AsNoTrackingWithIdentityResolution() and split query, as well as this specific query shape. |
Sounds good, thanks for looking into it @maumar! |
… throws ArgumentOutOfRangeException This is a regression introduced in 9.0 when trying to address a different regression (#33073) Error is caused by a bug in JsonCorrectOrderOfEntitiesForChangeTrackerValidator, specifically it uses the initial SelectExpression to analyze structure of various shaper expressions in the query. Problem is that RelationalSplitCollectionShaperExpression has its own SelectExpression that described the collection - we should use that select expression rather than the parent. Fix is to update SelectExpression used to process the expression when are processing RelationalSplitCollectionShaperExpression Fixes #34728
… throws ArgumentOutOfRangeException Port of #34742 Fixes #34728 Description Error is caused by a bug in JsonCorrectOrderOfEntitiesForChangeTrackerValidator, specifically it uses the initial SelectExpression to analyze structure of various shaper expressions in the query. Problem is that RelationalSplitCollectionShaperExpression has its own SelectExpression that described the collection - we should use that select expression rather than the parent. Customer impact Some queries using split query and AsNoTrackingWithIdentityResolution fail during compilation with a cryptic error (index out of range) there is no good workaround outside of not using split query and/or AsNoTrackingWithIdentityResolution. The scenario is quite niche, requiring two query customizations (split query and AsNoTrackingWithIdentityResolution) as well as a specific shape. How found Customer reported on 9 RC1. Regression Yes, introduced in 9 while attempting to fix another regression from EF8 (#33073) Testing Multiple tests added. Risk Low. Change is straightforward - updating the state used in one of our visitors, we use that strategy in numerous places. The visitor itself is used for validation - it doesn't manipulate the shape of the query.
… throws ArgumentOutOfRangeException (#34742) This is a regression introduced in 9.0 when trying to address a different regression (#33073) Error is caused by a bug in JsonCorrectOrderOfEntitiesForChangeTrackerValidator, specifically it uses the initial SelectExpression to analyze structure of various shaper expressions in the query. Problem is that RelationalSplitCollectionShaperExpression has its own SelectExpression that described the collection - we should use that select expression rather than the parent. Fix is to update SelectExpression used to process the expression when are processing RelationalSplitCollectionShaperExpression Fixes #34728
… throws ArgumentOutOfRangeException (#34742) (#34743) This is a regression introduced in 9.0 when trying to address a different regression (#33073) Error is caused by a bug in JsonCorrectOrderOfEntitiesForChangeTrackerValidator, specifically it uses the initial SelectExpression to analyze structure of various shaper expressions in the query. Problem is that RelationalSplitCollectionShaperExpression has its own SelectExpression that described the collection - we should use that select expression rather than the parent. Fix is to update SelectExpression used to process the expression when are processing RelationalSplitCollectionShaperExpression Fixes #34728
I've tried using the following packages from the dotnet9 feed, but I still get the same error.
It looks like #34743 (merged 20 hours ago) hasn't landed there yet. Or am I doing something wrong? |
@bkoelman try again in a couple days. |
It looks like the fix made it into |
@bkoelman yep, that makes sense - we branched for rc.2 a while ago. |
Can you confirm this fix will ship in EF9 RTM? With the fix, our ~9000 tests are green now. |
Yes - that's what it means for the fix to be in 9.0.0-rtm.24508.5. |
File a bug
When running our test suite against EF Core 9 RC1, I see various cases where an
ArgumentOutOfRangeException
is thrown. These tests succeed when run against the latest versions of EF Core 8 and 6, as well as 9.0.0-preview.3.24172.4. I've verified the crash happens both with Npgsql and Sqlite, which is why I believe the issue is in EF Core and not provider-related. It appears the problem was introduced in v9.0.0-preview.7.24405.3.Steps to reproduce
Microsoft.EntityFrameworkCore.Sqlite
(9.0.0-rc.1.24451.1) andNpgsql.EntityFrameworkCore.PostgreSQL
(9.0.0-rc.1).Program.cs
and run.Include your code
Contents of
Program.cs
:Include stack traces
The text was updated successfully, but these errors were encountered: