NDLRGEN059: Record constructor-overload property is unsupported¶
Cause¶
A marked property cannot be represented safely by the generated public forwarding constructor.
Rule Description¶
The property must be directly declared, instance, non-indexed, non-positional,
non-required, assignable through init or set, and typed accessibly enough for the
generated public constructor. Pointer types are unsupported because the generated file is
not compiled in an unsafe context.
How to Fix¶
// WRONG
public partial record Request(string Name)
{
[RecordConstructorOverloadParameter]
public required int Revision { get; init; }
}
// CORRECT
public partial record Request(string Name)
{
[RecordConstructorOverloadParameter]
public int Revision { get; init; }
}
Remove the marker when the property should not participate, or change the property to a supported shape.