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

dotnet format won't newline an empty catch block #44564

Open
LuizAugustoPSchmidt opened this issue Oct 31, 2024 · 1 comment
Open

dotnet format won't newline an empty catch block #44564

LuizAugustoPSchmidt opened this issue Oct 31, 2024 · 1 comment
Labels
Area-Format untriaged Request triage from a team member

Comments

@LuizAugustoPSchmidt
Copy link

Bug Description

dotnet format will not place a new line (as configured in .editorconfig) after the open braces ('{') character in a catch(){} block if it's empty

To Reproduce

Please refer to this repo for source code.
The command fails to format a file according to IDE2001 (set on the .editorconfig in the repo) if the embedded statement is an empty block (in this case, a catch{} block)

Further technical details

  • dotnet --info:
    .NET SDK (reflecting any global.json):
    Version: 6.0.425
    Commit: fcce060d9f

Runtime Environment:
OS Name: fedora
OS Version: 40
OS Platform: Linux
RID: fedora.40-x64
Base Path: /home/luizschmidt/.dotnet/sdk/6.0.425/

global.json file:
Not found

Host:
Version: 6.0.33
Architecture: x64
Commit: 6c636980f7

.NET SDKs installed:
6.0.425 [/home/luizschmidt/.dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.33 [/home/luizschmidt/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.33 [/home/luizschmidt/.dotnet/shared/Microsoft.NETCore.App]

Download .NET:
https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info

  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version:
    Visual Studio Code
    1.95.0
    912bb683695358a54ae0c670461738984cbb5b95
    x64
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Linux untriaged Request triage from a team member labels Oct 31, 2024
@LuizAugustoPSchmidt
Copy link
Author

It seems that the issue happens specifically when a semicolon is inserted after the closing bracket, which the command interprets as an embedded statement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Format untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants