How to Fix Automapper Error? “Unmapped members were found. Review the types and members below.”

A few days ago I installed Automapper in my C# project. And I faced with the next error: “Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination typ. For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters. AutoMapper created this type map for you, but your types cannot be mapped using the current configuration.”
My issue was in invalid configuration. I missed map configuration from one type to another. Here is a console application where I added configuration from Person type to the PersonModel type.

Screenshot with error:
Unmapped members were found. Automapper issue example in console application.

And screenshot after I uncomment configuration section(cfg.AddProfile(new AutoMapperProfiles());):
configured Automapper without errors

Map configuration:

public class AutoMapperProfiles: Profile
    public AutoMapperProfiles() 
        CreateMap<Person, PersonModel>();

Hope it was useful. And don’t forget to create a map configurations for nested classes. Thank you!

My artifacts are:

  • Visual Studio 2022
  • Console Application C# .net 7
  • Automapper 12.0.1

Leave a Comment