Skip to content

fix: cross-platform line endings in analyzer code fix providers#488

Merged
csharpfritz merged 1 commit intodevfrom
fix/analyzer-crlf-bug
Mar 21, 2026
Merged

fix: cross-platform line endings in analyzer code fix providers#488
csharpfritz merged 1 commit intodevfrom
fix/analyzer-crlf-bug

Conversation

@csharpfritz
Copy link
Copy Markdown
Collaborator

Problem

Code fix providers for BWFC002, BWFC004, BWFC010, BWFC012 hardcoded \r\n in SyntaxFactory.EndOfLine() calls. This causes test failures on Linux CI runners where source files use \n line endings.

Failing tests in PR #487:

  • ResponseRedirectAnalyzerTests.CodeFix_AddsNavigationManagerTodoComment
  • SessionUsageAnalyzerTests.CodeFix_SessionAccess_AddsTodoComment

Solution

Added SyntaxExtensions.DetectEndOfLine() helper that reads the first EndOfLineTrivia from the syntax tree, ensuring code fixes match the document's existing line ending style.

All 90 analyzer tests pass locally.

…rm CI

Code fix providers for BWFC002, BWFC004, BWFC010, BWFC012 hardcoded \r\n
in EndOfLine trivia, causing test failures on Linux CI runners where
source files have \n line endings.

Added SyntaxExtensions.DetectEndOfLine() helper that reads the first
EndOfLineTrivia from the syntax tree, ensuring code fixes match the
document's existing line ending style.

Fixes failing tests in PR #487.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@csharpfritz csharpfritz merged commit 83e0f45 into dev Mar 21, 2026
4 checks passed
@csharpfritz csharpfritz deleted the fix/analyzer-crlf-bug branch March 21, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant