4.2.0 .Include<DerivedSourceType, DerivedTargetType> throws exception with base type names
See original GitHub issueCreating a map and including a map which doesn’t exist throws an exception that doesn’t really help find the missing map.
Consider the following:
`
public class SourceDerived
{
}
public interface IMyInterface
{
}
public class TargetDerived : IMyInterface
{
}
[TestMethod]
public void MyTestMethod()
{
var config = new MapperConfiguration(cfg =>
cfg.CreateMap<object, IMyInterface>()
.Include<SourceDerived, TargetDerived>()
);
}
` The test throws an exception with message :
System.InvalidOperationException: Missing map from Object to IMyInterface. Create using Mapper.CreateMap<Object, IMyInterface>.
It is right to throw because I have not defined a map from SourceDerived to TargetDerived.
In my opinion it would be much more helpful if the message read:
System.InvalidOperationException: Missing map from SourceDerived to TargetDerived. Create using Mapper.CreateMap<SourceDerived , TargetDerived>.
@jbogard If you agree, I would happily provide a PR
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Exception Class (System)
When an error occurs, either the system or the currently executing application reports it by throwing an exception that contains information about the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yay I helped!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.