Skip to content

Conversation

@smitpatel
Copy link
Contributor

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 requested review from AndriySvyryd and maumar April 3, 2020 22:30
@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

3 participants