-
Notifications
You must be signed in to change notification settings - Fork 512
Description
.editorconfig
:
[*.cs]
end_of_line = lf
Example.cs
:
namespace Bug
{
public static class Example
{
public static int MissingNewLine(bool condition)
{
if (condition)
{
return 42;
} // SA1513: Closing brace should be followed by a blank line
return 0;
}
}
}
Applying the automatic fix for SA1513 (and probably a bunch of others, but this is the one where I tracked down the problem) inserts a CRLF (carriage return + line feed) combination, but the file uses LF only. In Visual Studio, you can observe the state of line endings for the current file in the bottom right corner of the file-editor pane. It should initially say LF
, when the automatic fix is applied it will switch to MIXED
instead:
The next time the file is opened (but not immediately when the problem is introduced!), Visual Studio will complain about mixed line endings, and suggest to 'normalize' the line endings (using the wrong default option, of-course):
The root-cause is probably because the fixer appears to use a hard-coded CRLF (SyntaxFactory.CarriageReturnLineFeed) rather than the currently configured line-end character.