I was completely thrown for a loop when experiencing this issue. I had all my DI components registered correctly, or so I thought. After a few hours poking around I finally discovered you need to pass a list of profileAssemblyMarkerTypes like so.
services.AddAutoMapper(config => {
config.AddProfile<MyMappingProfile>();
}, new List<Type> { typeof(MyConverter)});
There is a brief explanation found here of profile assembly types at the beginning of the DI section, but makes no mention of what these are or what they are used for or when they are needed
https://docs.automapper.org/en/stable/Dependency-injection.html
Now I just want to say I appreciate everything you do. Automapper is a great tool that I use in every .net project I work on. I am just asking you to please update your documentation to be more clear on the steps needed to use ITypeConverter or other components in your software. The only way to figure this out was to dig through your source code and find why the issue was occurring, then dig through your service extension methods to see if there was a way to fix it. That could have all been avoided with a brief one liner stating "your will need to register your typeconverter by passing it into the service extension as an assembly like so ..."
Lastly, I might add that I find the notion of simply passing in a list of assemblies counter intuitive. You really should have builder returned by your service extension where you can have methods that add such pieces. For example they can be used like this:
This would be a lot more intuitive than just passing in a list of assemblies to an extension method with no xml documentation comments that can explain what the parameter is even used for. Thanks for listening
This is less than an issue than a recommendation. I was experiencing the same issue as this guy.
https://github.com/AutoMapper/AutoMapper/issues/2825
I was completely thrown for a loop when experiencing this issue. I had all my DI components registered correctly, or so I thought. After a few hours poking around I finally discovered you need to pass a list of profileAssemblyMarkerTypes like so.
Now your explaination was correct. It was a DI configuration problem. However, my issue is that your documentation makes no mention of this at all here: https://docs.automapper.org/en/stable/Custom-type-converters.html?highlight=ITypeConverter#custom-type-converters .
There is a brief explanation found here of profile assembly types at the beginning of the DI section, but makes no mention of what these are or what they are used for or when they are needed https://docs.automapper.org/en/stable/Dependency-injection.html
Now I just want to say I appreciate everything you do. Automapper is a great tool that I use in every .net project I work on. I am just asking you to please update your documentation to be more clear on the steps needed to use ITypeConverter or other components in your software. The only way to figure this out was to dig through your source code and find why the issue was occurring, then dig through your service extension methods to see if there was a way to fix it. That could have all been avoided with a brief one liner stating "your will need to register your typeconverter by passing it into the service extension as an assembly like so ..."
Lastly, I might add that I find the notion of simply passing in a list of assemblies counter intuitive. You really should have builder returned by your service extension where you can have methods that add such pieces. For example they can be used like this:
services.AddAutoMapper(config => config.AddProfile\<MyProfile>) .AddTypeConverter\<MyTypeConverter>() .AddValueConverter\<MyValueConverter>();
This would be a lot more intuitive than just passing in a list of assemblies to an extension method with no xml documentation comments that can explain what the parameter is even used for. Thanks for listening