Skip to content
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

Fix to #34728 - Split query with AsNoTrackingWithIdentityResolution() throws ArgumentOutOfRangeException #34742

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Sep 23, 2024

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

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
@maumar maumar requested review from roji and a team September 23, 2024 22:54
maumar added a commit that referenced this pull request Sep 23, 2024
… 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.
@maumar maumar merged commit 00b08d7 into main Sep 24, 2024
7 checks passed
@maumar maumar deleted the fix34728 branch September 24, 2024 16:55
@maumar maumar restored the fix34728 branch September 24, 2024 16:55
@maumar maumar deleted the fix34728 branch September 24, 2024 16:55
maumar added a commit that referenced this pull request Sep 24, 2024
… 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
maumar added a commit that referenced this pull request Sep 25, 2024
… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split query with AsNoTrackingWithIdentityResolution() throws ArgumentOutOfRangeException
2 participants