Mapster icon indicating copy to clipboard operation
Mapster copied to clipboard

Mapping fails when a record property is `Ignore`d

Open amantinband opened this issue 1 year ago • 1 comments

The following will throw an exception:

public record User(string Name);
public record UserDto(string Name);
TypeAdapterConfig<User, UserDto>.NewConfig()
    .Ignore(dest => dest.Name);

var user = new User("Amichai");
var userDto = user.Adapt<UserDto>(); // <-- throws Mapster.CompileException: Error while compiling, with inner exception: System.ArgumentException: Incorrect number of arguments for constructor

Is this by design? Didn't see this documented

amantinband avatar Jul 22 '22 17:07 amantinband

This needs to be solved. It precludes the use of Mapster.

skuirrels avatar Jun 01 '23 22:06 skuirrels