apm-agent-dotnet
apm-agent-dotnet copied to clipboard
dotnet format creates different line endings on Windows vs Linux (and macOS)
More details on the original problem: https://github.com/elastic/apm-agent-dotnet/pull/560#issuecomment-543239630
Turned out that we had some files with windows style line ending (CRLF
) and some with linux/macOS style ending (LF
). My theory is that this triggered the bug above described in the comment which is that dotnet format
on macOS and Linux mixed line endings within a single file - so prior to dotnet format
we had different files with different line endings, now we have different line endings within a single file.
After changing all line endings to LF
in the whole repo the dotnet format
bug went away. In #566 everything is LF
and running dotnet format
on macOS, Linux, and Windows does not reformat anything and our code style check command also passes.
~~I'm having this bug too. I just added this to my CI (Drone) and experienced the same results.~~
Correction the issue I witnessed was also related to git pulling the repo with LF file endings in windows. The issue was fixed by changing end_of_line to lf in the .editorconfig file, running the tool and pushing. But there should be a parameter or to at least have consistent line endings and not a specific one.
It behaves similarly on Windows in files with LF
line endings, when the file has CRLF
it's without a problem, but when the file has LF
then often after running dotnet format
it gets the mixed line endings. Not every file, but it's consistent, when some file has this issue, it gets the mixed line endings every time I run dotnet format
.