This analyzer in Visual Studio annoys the heck out of me, "IDE2001 Embedded statements must be on their own line" even triggers on while (true) { ... }
. How is true
an embedded statement?
This also has no solution in the VS IDE. It offers no solution or idea of how to not be doing this.
I cannot find a way to turn this off in the .editorconfig
file or the options within Visual Studio. Could someone help me with what I need to paste into the editorconfig file?
It's not the true
from your while
. It's the {
at the end of the line.
I struggled with this, too. I could not disable it through the analyzer severits explicitly.
The only way I found to get rid of it is to lower the severity as one of the c# settings:
So instead of
csharp_style_allow_embedded_statements_on_same_line_experimental = false:warning
I had to change it to
csharp_style_allow_embedded_statements_on_same_line_experimental = false
.
With that setting all of these diagnostics went away.