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

[release/9.0] Fix to #34728 - Split query with AsNoTrackingWithIdentityResolution() throws ArgumentOutOfRangeException #34743

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Sep 23, 2024

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 requested a review from roji September 23, 2024 23:48
@maumar maumar changed the title Fix to #34728 - Split query with AsNoTrackingWithIdentityResolution() throws ArgumentOutOfRangeException [release/9.0] Fix to #34728 - Split query with AsNoTrackingWithIdentityResolution() throws ArgumentOutOfRangeException Sep 23, 2024
@maumar maumar requested a review from a team September 24, 2024 17:50
… 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
Copy link
Contributor Author

maumar commented Sep 25, 2024

ping @roji @cincuranet @AndriySvyryd

@maumar maumar merged commit 54ff7e6 into release/9.0 Sep 25, 2024
7 checks passed
@maumar maumar deleted the fix34728_90 branch September 25, 2024 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants