Skip to content

SA1137 is not raised in C# 12 collection expressions #3904

Open
@ar-schraml

Description

@ar-schraml

The error code SA1137: Elements should have the same indentation is not raised in C# 12 collection expressions.

Example:
image
SA1137 is correctly raised inside an object initialization (example1), but it is missing in collection expressions (example2)

Example code

    private readonly List<string> example1 = new()
    {
        "a",
"b",
                "c",
    };

    private readonly List<string> example2 =
    [
        "a",
"b",
                "c",
    ];

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions