Closed mc0re closed 4 years ago
What's even stranger, even this profile produces the error:
public class UserDtoMappingProfile : Profile
{
public UserDtoMappingProfile()
{
CreateMap<UserModel, UserDto>()
.ForMember(d => d.Id, opt => opt.Ignore())
.ForMember(d => d.UserName, opt => opt.Ignore())
.ForMember(d => d.FullName, opt => opt.Ignore())
.ForMember(d => d.Roles, opt => opt.Ignore())
.ForAllOtherMembers(opt => opt.Ignore())
;
}
}
Yes, one might think the profile is not picked up - but it is sitting side by side with other profiles, which are definitely picked up.
Don't do that AppDomain
thing - explicitly specify your assemblies.
I think this is better suited for StackOverflow.
This is a usage problem - your DI configuration is unneeded (this is done by the AddAutoMapper
method, and you shouldn't scan the AppDomain. Pass in your assemblies to scan explicitly. However, because this is a usage problem based on your exception, it's better suited for SO because that'll be better for anyone else in the future that encounters the same problem.
Okay, for the record - I confirm that explicitly specifying assemblies fixed the issue.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Source/destination types
Source:
Destination
Mapping configuration
Tried two variants.
Automatic
Fully specified
Injection configuration:
Version: 9.0.0 and 10.0.0
Expected behavior
No error
Actual behavior
Steps to reproduce
Simple test case.