Skip to content

Ignore nullable property does warning CS8603 #520

@heggi

Description

@heggi

.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);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions