MapsterMapper / Mapster

A fast, fun and stimulating object to object Mapper
MIT License
4.3k stars 328 forks source link

Ignore nullable property does warning CS8603 #520

Open heggi opened 1 year ago

heggi commented 1 year ago

.Net 7.0 with nullable enabled

public struct Dest
{
    public string Name { get; set; }
    public string? NullableString { get; set; }
}

public struct Source
{
    public string Name { get; set; }
}

public class Mapping : IRegister
{
    public void Register(TypeAdapterConfig config)
    {
        config.NewConfig<Source, Dest>()
            .Ignore(d => d.NullableString); // this string a got a warning message CS8603: Possible null reference return
    }
}

image

I think that signature of Ignore method need to be public TypeAdapterSetter<TSource, TDestination> Ignore(params Expression<Func<TDestination, object?>>[] members);