Skip to content

[release/8.0] Visit arguments in QueryableMethodNormalizingExpressionVisitor after converting List.Contains (#32219)#32266

Merged
roji merged 1 commit into
dotnet:release/8.0from
roji:OtherContainsFixes8.0
Nov 13, 2023
Merged

[release/8.0] Visit arguments in QueryableMethodNormalizingExpressionVisitor after converting List.Contains (#32219)#32266
roji merged 1 commit into
dotnet:release/8.0from
roji:OtherContainsFixes8.0

Conversation

@roji

@roji roji commented Nov 9, 2023

Copy link
Copy Markdown
Member

Fixes #32215 and #32218, backports #32219

(cherry picked from commit 08ee676)

Description

  1. When converting List.Contains() to Queryable.Contains() in preprocessing, QueryableMethodNormalizingExpressionVisitor does not visit into the instance/arguments of the expressions. As a result, normalization does not happen recursively.
  2. When identifying Contains for legacy pre-8.0-style translation (expansion of parameter list to constants in SQL), if AsQueryable() as composed over the parameter list, the construct isn't identified and translation fails.

The two bugs are fixed in the same PR as fixing the 1st exposes the 2nd.

Customer impact

The 1st bug can affect any LINQ query containins List.Contains(); if either the instance or the argument requires normalization, that normalization won't occur and query translation will likely fail. This can affect an unknown number of queries.

How found

Customer reported on 8.0

Regression

Yes.

Testing

Added tests.

Risk

Very low; separate quirks for both bugs have been added.

@roji roji force-pushed the OtherContainsFixes8.0 branch from 5eee914 to 85268a4 Compare November 13, 2023 13:20
@roji roji merged commit 7c8127b into dotnet:release/8.0 Nov 13, 2023
@roji roji deleted the OtherContainsFixes8.0 branch November 13, 2023 13:58
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.

3 participants