chore: pin .cs line endings to LF for deterministic formatting - #99
Merged
Conversation
dotnet format has no end_of_line setting in .editorconfig, so it fell back to the OS default (CRLF on Windows, LF on Linux). Combined with .gitattributes '*.cs text' (native eol on checkout), local 'dotnet format --verify' results depended on each contributor's core.autocrlf, producing spurious whitespace failures on autocrlf=input machines while CI (Windows, autocrlf=true) stayed green. Pin .cs to LF in both .editorconfig (end_of_line = lf) and .gitattributes (*.cs text eol=lf) so formatting is deterministic on every platform. Blobs are already LF, so this is a no-op for file content.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
dotnet formathas noend_of_linesetting in.editorconfig, so it falls back to the OS default — CRLF on Windows, LF on Linux. Combined with.gitattributes '*.cs text'(native eol on checkout), localdotnet format --verifyresults depend on each contributor'score.autocrlf:autocrlf=true) checks out CRLF → passes (green today).core.autocrlf=inputchecks out LF →dotnet formatwants CRLF → spurious whitespace failures (e.g.SymbolMapReuseTest.csin local-ci).There is no actual whitespace defect in any file — it's purely nondeterministic line-ending handling.
Fix
Pin
.csto LF on both sides so formatting is deterministic on every platform:.editorconfig:end_of_line = lfunder[*.{cs,vb}].gitattributes:*.cs text eol=lfBlobs are already LF (
git add --renormalizewas a no-op), so this changes no file content — only how.csis checked out and whatdotnet formatexpects. VS project files remaineol=crlfas before.Verification
bash scripts/local-ci.sh lint→ Whitespace OK, Style OK, Analyzers OK oncore.autocrlf=input(previously failed).