roslyn: IDE0055 triggered incorrectly with UNIX only line ending

Version Used: “C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn\csc.exe” Microsoft ® Visual C# Compiler version 3.10.0-4.21269.26 (02984771) Copyright © Microsoft Corporation. All rights reserved.

Steps to Reproduce: This constantly popup during my project build. The fix is to change from UNIX “0x0a” to DOS “0x0d 0x0a” on that specific line only.

NLogLoggerGeneric.cs(8,50): error IDE0055: Fix formatting

image

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 22 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Putting this frustrating matter aside, I welcome everyone to reflect on the amusing fact that now, in 2022, we have this bug report for the C# compiler’s static code analysis feature because 60 years ago some people needed to instruct electromechanical teleprinters.

I have windows line endings on my machine, and when it gets committed and pushed to devops I have linux line endings.

I think that is happening because of git settings.

So I’m confused on what the recommended approach is. What am I doing wrong?

I’m also not sure why I see only a few errors instead of lots of errors.

I put some vscode screenshots here:

#61042

There are three reasons why this could be occurring:

  1. Not all files have Unix-style endings in the CI build (this can happen if one or more files in source control is not normalized, or if .gitattributes is missing text=auto for the line that applies to *.cs files)
  2. The CI build is running on a system where Environment.NewLine is \r\n
  3. One or more .editorconfig files applied to the build specifies an end_of_line value