Open
Description
This scenario is allowed and the compiler doesn't fail:
[Strongly]
public partial record struct ProductId(Guid Value);
However it generates an extra Value
field that shadows the one that is provided in the constructor:
readonly partial record struct ProductId : System.IFormattable, System.IParsable<ProductId>
{
public System.Guid Value { get; }
As a result, values that are created with the constructor are "missing" the provided inner value:
var pid = new ProductId(Guid.NewGuid());
// pid.value == Guid.Empty