Skip to content

Fix invalid csharp_space_around_declaration_statements option value#120201

Merged
agocke merged 1 commit into
dotnet:mainfrom
xtqqczze:csharp_space_around_declaration_statements
Feb 3, 2026
Merged

Fix invalid csharp_space_around_declaration_statements option value#120201
agocke merged 1 commit into
dotnet:mainfrom
xtqqczze:csharp_space_around_declaration_statements

Conversation

@xtqqczze

@xtqqczze xtqqczze commented Sep 29, 2025

Copy link
Copy Markdown
Contributor

The only valid option values are ignore and false. The default option value is false, so the invalid option value do_not_ignore was implicitly false.

https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options#csharp_space_around_declaration_statements

image

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Sep 29, 2025
@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 29, 2025
@xtqqczze

Copy link
Copy Markdown
Contributor Author

Build Analysis is green.

@akoeplinger

Copy link
Copy Markdown
Member

the original PR which added the option (dotnet/roslyn#15020) explicitly had ignore/do_not_ignore as options and there's also a test in roslyn that verifies this option parses the same as false. Maybe we should just update the docs?

I'm mainly asking because this value is set in almost all .editorconfig files in the dotnet github org

@akoeplinger akoeplinger added area-Infrastructure and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Nov 3, 2025
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@xtqqczze

xtqqczze commented Nov 3, 2025

Copy link
Copy Markdown
Contributor Author

the original PR which added the option (dotnet/roslyn#15020) explicitly had ignore/do_not_ignore as options and there's also a test in roslyn that verifies this option parses the same as false. Maybe we should just update the docs?

It doesn't look that PR actually implemented a do_not_ignore option. In any case, the current implementation only uses ignore and false:

https://github.com/dotnet/roslyn/blob/e628ec67ac5d6cf4ab52650cee1eee45a7738ff6/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/CSharpFormattingOptions2.cs#L118-L130

@xtqqczze

xtqqczze commented Nov 3, 2025

Copy link
Copy Markdown
Contributor Author

@akoeplinger I've updated the PR description to show this is explicitly flagged as an error in JetBrains Rider.

@akoeplinger

Copy link
Copy Markdown
Member

What Rider does is not relevant here IMO, they've probably just implemented what the docs say.

https://github.com/dotnet/roslyn/blob/e628ec67ac5d6cf4ab52650cee1eee45a7738ff6/src/Workspaces/CSharpTest/Formatting/EditorConfigOptionParserTests.cs#L111-L118 shows the Roslyn test, the implementation just treats any value that is not ignore as false.

Would you mind filing a roslyn issue about this?

I don't particularly care what we set but there are over 60 hits in the dotnet org and I'm not sure it makes sense to just change runtime: https://github.com/search?q=org%3Adotnet+%22do_not_ignore%22+path%3A.editorconfig&type=code

@xtqqczze

xtqqczze commented Nov 3, 2025

Copy link
Copy Markdown
Contributor Author

Opened dotnet/roslyn#80996

@agocke agocke merged commit fbb11f1 into dotnet:main Feb 3, 2026
148 of 152 checks passed
lewing pushed a commit to lewing/runtime that referenced this pull request Feb 9, 2026
…dotnet#120201)

The only valid option values are `ignore` and `false`. The default
option value is `false`, so the invalid option value `do_not_ignore` was
implicitly `false`.


https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options#csharp_space_around_declaration_statements

<img width="1551" height="573" alt="image"
src="https://github.com/user-attachments/assets/67d0bc2e-7e1a-4a6a-85a9-ff11f5632191"
/>
@xtqqczze xtqqczze deleted the csharp_space_around_declaration_statements branch March 1, 2026 11:44
iremyux pushed a commit to iremyux/dotnet-runtime that referenced this pull request Mar 2, 2026
…dotnet#120201)

The only valid option values are `ignore` and `false`. The default
option value is `false`, so the invalid option value `do_not_ignore` was
implicitly `false`.


https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options#csharp_space_around_declaration_statements

<img width="1551" height="573" alt="image"
src="https://github.com/user-attachments/assets/67d0bc2e-7e1a-4a6a-85a9-ff11f5632191"
/>
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Infrastructure community-contribution Indicates that the PR has been added by a community member

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants