cezarypiatek / MappingGeneratorIssueTracker

This is a issue tracker for MappingGenerator
2 stars 0 forks source link

C# 11 Required Properties aren't Mapped #13

Open rfvgyhn opened 2 years ago

rfvgyhn commented 2 years ago

MappingGenerator fails to map properties that are marked required.

I know C# 11 is still in preview, but I thought I'd put it on your radar if it's not already there.

public class One
{
    public string Prop1 { get; set; }
    public required string Prop2 { get; set; }
}

public class Two
{
    public string Prop1 { get; set; }
    public required string Prop2 { get; set; }
}

Expected

public static Two Map(One one)
{
    return new Two
    {
        Prop1 = one.Prop1
        Prop2 = one.Prop2
    };
}

Actual

public static Two Map(One one)
{
    return new Two
    {
        Prop1 = one.Prop1
    };
}