Skip to content

Add a dedicated fixer to fixup code in expression trees that is now calling restricted apis #76124

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

Merged

Conversation

CyrusNajmabadi
Copy link
Member

Fixes #74030

This was a request from the LDM for users who run into cases where their expression trees no longer compile because the compiler now picks an overload of the method they were calling that is not legal to use in an expression tree. For example, switching to a params ReadOnlySpan<...> method from a params T[] method.

The fixer switches the code to use explicit types to ensure this continues working.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner November 27, 2024 22:21
@ghost ghost added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 27, 2024
var originalParameter = originalMethod.Parameters[i];
var currentParameter = currentMethod.Parameters[i];

// Different parameter types, look for another sibling that matches
Copy link
Contributor

Choose a reason for hiding this comment

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

// Different parameter types, look for another sibling that matches

nit: consider moving to caller

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

@CyrusNajmabadi CyrusNajmabadi merged commit a8af111 into dotnet:main Dec 2, 2024
28 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Dec 2, 2024
@CyrusNajmabadi CyrusNajmabadi deleted the fixParamsInExpressionTree branch December 2, 2024 21:29
@dibarbet dibarbet modified the milestones: Next, 17.13 P3 Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add fixer when for params span overloads are used with Expression selected
3 participants