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

Query: Parameterize components of NewExpression when possible #20522

Merged
merged 1 commit into from
Apr 3, 2020

Conversation

smitpatel
Copy link
Member

Issue: When evaluating MemberInitExpression/ListInitExpression, we skipped visiting inner NewExpression if other components were not evaluatable.
We did this since if we cannot evaluate NewExpression otherwise due to structure of expression which does not take ParmeterExpression in place of NewExpression.
But existing logic skipped visiting NewExpression altogether, leaving behind closure variable inside NewExpression.
Fix: Visit NewExpression so that it's components are marked for parameterization and explicitly disallow evaluating NewExpression

Resolves #20502

Issue: When evaluating MemberInitExpression/ListInitExpression, we skipped visiting inner NewExpression if other components were not evaluatable.
We did this since if we cannot evaluate NewExpression otherwise due to structure of expression which does not take ParmeterExpression in place of NewExpression.
But existing logic skipped visiting NewExpression altogether, leaving behind closure variable inside NewExpression.
Fix: Visit NewExpression so that it's components are marked for parameterization and explicitly disallow evaluating NewExpression

Resolves #20502
@smitpatel smitpatel merged commit f878125 into master Apr 3, 2020
@smitpatel smitpatel deleted the smit/lalalala branch April 3, 2020 23:30
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.

InvalidOperationException when using constructor parameter in LINQ projection
2 participants