Skip to content

Conversation

@roji
Copy link
Member

@roji roji commented Nov 17, 2025

Fixes #37189

Description

When the same parameter is referenced multiple times, EF performs deduplication to send only a single SQL parameter to the database, reducing transfer size etc. 10.0 Introduced various changes to this mechanism as part of the general parameter logic cleanup (in #35200), and a one-lineer bug slipped in.

Customer impact

This bug can manifest in various ways when the same parameter or referenced multiple times, or multiple parameters are different only in case sensitivity (see, #37096, #36917 (comment)). This can cause queries which previously worked to fail, and in worse edge cases, queries to return incorrect data because of deduplication to the wrong parameter with the wrong store type (data corruption).

How found

Multiple customers reported on 10.0.0

Regression

Yes

Testing

Testing already existed, but asserted incorrectly.

Risk

Very low, one-line trivial change. Quirk added.

@roji roji requested a review from a team as a code owner November 17, 2025 16:59
@roji roji changed the base branch from main to release/10.0 November 17, 2025 16:59
@roji roji changed the title Fix parameter deduplication logic bug [release/10.0] Fix parameter deduplication logic bug Nov 17, 2025
@roji roji requested a review from artl93 November 17, 2025 16:59
Copy link
Member

@artl93 artl93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the old behavior switch switching on the 10.0.0 behavior, or is it putting in the 9.0 behavior… Trying to follow

@roji
Copy link
Member Author

roji commented Nov 17, 2025

Is the old behavior switch switching on the 10.0.0 behavior, or is it putting in the 9.0 behavior…

The switch switches to the (buggy) 10.0.0 behavior, just in case. 9.0 was quite a different implementation so there's no option to switch to that; but we're not aware of a problem with the general 10.0 implementation - just this one-liner typo bug.

@roji roji disabled auto-merge November 17, 2025 19:59
@roji roji enabled auto-merge (rebase) November 17, 2025 19:59
@roji roji merged commit 96f3c38 into dotnet:release/10.0 Nov 17, 2025
7 checks passed
@roji roji deleted the ParameterDeduplication branch November 17, 2025 20:06
@roji roji added this to the 10.0.1 milestone Nov 18, 2025
@roji roji linked an issue Dec 3, 2025 that may be closed by this pull request
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.

JsonScalarExpression.VisitChildren() has wrong loop logic Incorrect logic in 10.0 parameter deduplication step

4 participants