Skip to content

don't crash removing an unused variable assigned under an if without braces - #86087

Merged
jasonmalinowski merged 3 commits into
dotnet:mainfrom
lagudafuadtosin:fix-78528
Oct 26, 2026
Merged

jasonmalinowski merged 3 commits into
dotnet:mainfrom
lagudafuadtosin:fix-78528

Conversation

@lagudafuadtosin

@lagudafuadtosin lagudafuadtosin commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

fixes #78528

the assignment was the only statement under the if, so removing it left nothing there and the fixer threw. it now becomes an empty block. test added.

Microsoft Reviewers: Open in CodeFlow

…r an if without braces becomes an empty block instead of crashing

Fixes dotnet#78528
@lagudafuadtosin
lagudafuadtosin requested a review from a team as a code owner October 16, 2026 05:33
@dotnet-policy-service dotnet-policy-service Bot added Community The pull request was submitted by a contributor who is not a Microsoft employee. VSCode labels Oct 16, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@jasonmalinowski jasonmalinowski self-assigned this Oct 16, 2026

@jasonmalinowski jasonmalinowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oops sorry I never actually posted the comment...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee. VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSharpRemoveUnusedVariableCodeFixProvider crashes if unused variable value is set in an if statement with no braces

5 participants