dotnet/roslyn

Unexpected formatting when attribute is on same line as property with default value

Offen

#50.017 geöffnet am 16.12.2020

 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)C# (4.257 Forks)batch import
Area-IDEBugIDE-Formatterhelp wanted

Repository-Metriken

Stars
 (20.414 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)

Beschreibung

The code

namespace Foo
{
    public class Bar
    {
        [Parameter] public DelegateType Value { get; set; } = (value, second) => (builder) =>
        {
            builder.Baz();
        };
    }
}

reformats to

namespace Foo
{
    public class Bar
    {
        [Parameter]
        public DelegateType Value { get; set; } = (value, second) => (builder) =>
{
builder.Baz();
};
    }
}

I would expect

namespace Foo
{
    public class Bar
    {
        [Parameter]
        public DelegateType Value { get; set; } = (value, second) => (builder) =>
        {
            builder.Baz();
        };
    }
}

or actually to do nothing at all.


dotnet format version is 4.1.131201

Contributor Guide