Skip to content

error WHITESPACE in face of collection expression #2217

@nietras

Description

@nietras

dotnet --info

.NET SDK:
 Version:           8.0.403
 Commit:            c64aa40a71
 Workload version:  8.0.400-manifests.47119bbc
 MSBuild version:   17.11.9+a69bbaaf5

global.json

{
  "sdk": {
    "version": "8.0.403",
    "rollForward": "latestPatch",
    "allowPrerelease": false
  }
}

csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
</Project>

Program.cs

Method();

static void Method()
{
    byte[] expected = [0x01, 0x02,
                       0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
                       0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16];
}

Run dotnet format --verify-no-changes results in errors when it shouldn't:

Program.cs(5,29): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(6,9): error WHITESPACE: Fix whitespace formatting. Delete 15 characters. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(6,29): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(6,35): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(6,41): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(6,47): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(6,53): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(6,59): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(6,65): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(6,71): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(6,77): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(7,9): error WHITESPACE: Fix whitespace formatting. Delete 15 characters. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(7,29): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(7,35): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(7,41): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(7,47): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(7,53): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(7,59): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(7,65): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(7,71): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]
Program.cs(7,77): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [DotnetFormatIssueWhitespaceCollectionExpression.csproj]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions