In Visual Studio 2017 I go to Tools > Options > Text Editor > C# > Code Style, and toggle the option "Prefer braces" from yes to no and back.
It does nothing. The preview below the options always has braces regardless of the setting.
Even an explicit .editorconfig file on csharp_prefer_braces = false:none does not change the behavior.
Is this a bug? Or is some other option overriding?
The property after the ":" will decide how this is treated in VS Code. So using none will mean that VSCode doesn't actually enforce this.
The MS docs here describe "none" as:
"None": Do not show anything to the user when this rule is violated. Code generation features generate code in this style, however. Rules with none severity never appear in the Quick Actions and Refactorings menu. In most cases, this is considered "disabled" or "ignored".
Perhaps you could try using csharp_prefer_braces = false:error instead?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With