Skip to content

Rosyln error CS9036 not described #46104

@RufusJWB

Description

@RufusJWB

It seems that the compiler error CS9036 is nowhere described. It would be great, if you could provide a documentation about it. Thank you!

This refers to the following scenario razor.fyi

class C
{
    public string? Prop { get; set; }
}
class Program
{
    public required C C { get; set; }
    static void Main()
    {
        var program = new Program()
        {
            // error CS9036: Required member 'Program.C' must be assigned a value, it cannot use a nested member or collection initializer.
            C = { Prop = "a" }
        };
    }
}

Associated WorkItem - 434158

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions