Version Used:
VisualStudio-15.7.4
Steps to Reproduce:
Create a .editorconfig in the root of your C# project with the following contents:
root = true
[*]
end_of_line = lf
insert_final_newline = true
Type a root element, for example <x/>, on the last line of the XML template. Your file should look like the following and have no newline at the end:
Save the new XML file. The editor should add a newline at the end so that VS displays the file as having three lines.

Expected Behavior:
Best: The entire file is LF.
Acceptable: The entire file is CRLF.
Actual Behavior:
The first line is terminated with CRLF and the second line is terminated with LF.
$ hexdump.exe -C XMLFile1.xml
00000000 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 |<?xml version="1|
00000010 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 75 74 |.0" encoding="ut|
00000020 66 2d 38 22 20 3f 3e 0d 0a 3c 78 2f 3e 0a |f-8" ?>..<x/>.|
0000002e
or, as Emacs renders it:
<?xml version="1.0" encoding="utf-8" ?>^M
<x/>
When I open the file again in the future with VS, it prompts me if I want to fix the newlines to be consistent.
The newlines originally were self-consistent, but VS made them inconsistent when it appended the newline at the end of the file.
This is a bug in the core Visual Studio editor, not Roslyn. I recommend filing a feedback ticket with the same information you've provided above, and it will get routed to the appropriate team.
/cc @olegtk @AmadeusW
@sharwell Are you sure? #23143 seems pretty similar to this and I can鈥檛 tell how I鈥檓 supposed to guess which component this belongs with.
I will file the feedback and link back to it. It will take me a bit.
I can鈥檛 tell how I鈥檓 supposed to guess which component this belongs with.
Guessing is fine, we're here to help when it goes to the wrong place. The people I CC'd in my reply are members of a team at least closer to the one that will get this bug. You had a good report, I wanted to make sure it gets seen. 馃槃
I have posted to the feedback community at https://developercommunity.visualstudio.com/content/problem/277772/editorconfig-bad-interaction-bewteen-end-of-linelf.html . Thanks for the help!
@binki I'm impressed. Not sure I could file a bug report that cleanly presented myself! Thank you! 馃槃
Most helpful comment
Guessing is fine, we're here to help when it goes to the wrong place. The people I CC'd in my reply are members of a team at least closer to the one that will get this bug. You had a good report, I wanted to make sure it gets seen. 馃槃