dotnet / dotnet/sdk

dotnet format won't newline an empty catch block

Open
#44,564 1 comment 0 reactions 0 assignees View on GitHub
Area-Format untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### 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](https://github.com/LuizAugustoPSchmidt/DotnetEditorConfigBug/tree/master) 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.