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

Fix Introduce Parameter Crash #72191

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

akhera99
Copy link
Member

@akhera99 akhera99 commented Feb 20, 2024

Fixes #72034

@akhera99 akhera99 requested a review from a team as a code owner February 20, 2024 22:30
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 20, 2024
@CyrusNajmabadi
Copy link
Member

I don't see a test that shows how this fixes things. As teh problem is uncorrectly rewriting a conditional binding (?.), i'm not sure how this addresses things.

@akhera99
Copy link
Member Author

I don't see a test that shows how this fixes things. As teh problem is uncorrectly rewriting a conditional binding (?.), i'm not sure how this addresses things.

I tagged the wrong issue sorry, this is just a more thorough fix for the #72034

FeaturesResources.into_extracted_method_to_invoke_at_call_sites, allOccurrences: false, IntroduceParameterCodeActionKind.Trampoline));
actionsBuilderAllOccurrences.Add(CreateNewCodeAction(
FeaturesResources.into_extracted_method_to_invoke_at_call_sites, allOccurrences: true, IntroduceParameterCodeActionKind.Trampoline));
var containsObjectCreationReferences = methodCallSites.Values.SelectMany(invocations => invocations).Any(invocation => syntaxFacts.IsObjectCreationExpression(invocation));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var containsObjectCreationReferences = methodCallSites.Values.SelectMany(invocations => invocations).Any(invocation => syntaxFacts.IsObjectCreationExpression(invocation));
var containsObjectCreationReferences = methodCallSites.Values.Flatten().Any(invocation => syntaxFacts.IsObjectCreationExpression(invocation));

Copy link
Member

Choose a reason for hiding this comment

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

.OfType<TObjectCreationExpression>().Any()

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regular occurrence of CSharpIntroduceParameterCodeRefactoringProvider error
3 participants