Skip to content

Treat .NET 7 required properties as actually required by default #862

Open
@DoctorKrolic

Description

@DoctorKrolic

Code snippet:

public class Options
{
    [Option]
    public required int Port { get; init; }

    [Option]
    public required string Server { get; init; }
}

Expected behaviour: Both Port and Server are required and the parsing fails if at least on of them is not present.

Actual behaviour: They are not required, I still have to specify [Option(Required = true)] in order for it to work

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