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/6.0] Query: Assign proper type to collection result expression (part 2) #27664

Merged
merged 1 commit into from
Apr 5, 2022

Conversation

smitpatel
Copy link
Member

@smitpatel smitpatel commented Mar 17, 2022

This improves the fix made in #27134

In earlier PR we converted IQueryable<T> to IEnumerable<T> becaused we converted enumerable to queryable during preprocessing phase and types aligned in later phase since we create a list (which does implement IEnumerable<T>). Though this implementing behavior doesn't work when returning a single result of enumerable during async which wraps collection type inside Task.
The better fix is to assign List<T> as type since we are eventually creating a list.
In case of single result, the single result operator has generic type which will introduce convert node into it automatically which will match types for async tasks.

Resolves #27600

Description
Applying single result operator (First(OrDefault) and family) on queryable of enumerable throws exception during async code path due to mismatch type in the delegate.

Customer impact
Customers running query which are affected by scenario will see exception rather than correct results.

How found
Customer reported on 6.0.2

Regression
Yes, introduced on 6.0.2 through #27134

Testing
Added test for affected scenario.

Risk
Low. This change makes type closer to what we actually generate at runtime. Also added quirk to revert back to older behavior.

@smitpatel smitpatel requested a review from maumar March 17, 2022 22:10
This improves the fix made in #27134

In earlier PR we converted `IQueryable<T>` to `IEnumerable<T>` becaused we converted enumerable to queryable during preprocessing phase and types aligned in later phase since we create a list (which does implement `IEnumerable<T>`). Though this implementing behavior doesn't work when returning a single result of enumerable during async which wraps collection type inside Task.
The better fix is to assign `List<T>` as type since we are eventually creating a list.
In case of single result, the single result operator has generic type which will introduce convert node into it automatically which will match types for async tasks.

Resolves #27600
@ajcvickers ajcvickers added this to the 6.0.x milestone Apr 5, 2022
@leecow leecow modified the milestones: 6.0.x, 6.0.5 Apr 5, 2022
@dougbu dougbu merged commit 70f9292 into release/6.0 Apr 5, 2022
@dougbu dougbu deleted the smit/6.0/issue27600 branch April 5, 2022 22:50
@ajcvickers ajcvickers removed this from the 6.0.5 milestone Apr 18, 2022
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.

5 participants