Skip to content

ObjectCreationMutator empty-initializer mutation fails CS9035 on types with required members #3598

@slang25

Description

@slang25

Split out from #3594.

ObjectCreationMutator always emits an empty-initializer variant (new Notification {}), which fails CS9035 ("Required member 'X' must be set in the object initializer or attribute constructor") when the type has C# 11 required properties/fields.

Proposed fix: skip the empty-initializer mutation when the resolved type (or any base) has a member with IsRequired == true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions