Skip to content

csproj formatting adds some unexpected trailing whitespace on windows only #1660

@shocklateboy92

Description

@shocklateboy92

Input:

Here is an minimal project that reproduces the error:
CSharpier-bug-proj-formatting-windows.zip

Output:

diff --git a/ProcessorFunction.csproj b/ProcessorFunction.csproj
index 40ea096..0acc8c1 100644
--- a/ProcessorFunction.csproj
+++ b/ProcessorFunction.csproj
@@ -30,11 +30,11 @@
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" OutputItemType="Analyzer" />
-    <!--
-      MSAL has a bug where it just fails to get a managed identity credential.
-      https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/5077#issuecomment-2590013438
-
-      Keep the following 3 packages pinned until the issue is resolved.
+    <!--^M
+      MSAL has a bug where it just fails to get a managed identity credential.^M
+      https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/5077#issuecomment-2590013438^M
+^M
+      Keep the following 3 packages pinned until the issue is resolved. ^M
     -->
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Microsoft.Identity.Client" />

Expected behavior:

No changes, as the input file is already formatted.

This caused us some issues because our CI builds run on Linux which does not have this issue. So when the people that Windows for development build on their local machines, CSharpier.MSBuild changes the formatting, which causes their PRs to fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions