Skip to content

Mapping fails when a record property is Ignored #456

Open
@amantinband

Description

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

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions