Update to AutoMapper 7.0.0 causes exceptions
See original GitHub issueMapping that works as expected in 6.2.2 and earlier fails with a MissingMethodException in 7.0.0
AutoMapper.AutoMapperMappingException
HResult=0x80131500
Message=Error mapping types.
Source=<Cannot evaluate the exception source>
StackTrace:
<Cannot evaluate the exception stack trace>
Inner Exception 1:
MissingMethodException: Method not found: 'System.__Canon AutoMapper.IRuntimeMapper.Map(System.__Canon, System.__Canon, AutoMapper.ResolutionContext)'.
Inner exception is:
{System.MissingMethodException: Method not found: 'System.__Canon AutoMapper.IRuntimeMapper.Map(System.__Canon, System.__Canon, AutoMapper.ResolutionContext)'.
at AutoMapper.Mappers.EquivalentExpressionAddRemoveCollectionMapper.Map[TSource,TSourceItem,TDestination,TDestinationItem](TSource source, TDestination destination, ResolutionContext context, IEquivalentComparer`2 _equivalentComparer)
at lambda_method(Closure , UpdateViewModel , Model, ResolutionContext )}
Stack Trace
" at lambda_method(Closure , UpdateViewModel , Model, ResolutionContext )\r\n at Controller.Map[TA,TB](TA source, TB destination) in D:\\dev\\Controller.cs:line 63"
I have tried to determine the cause but have been unable to do so.
My mapping looks like this:
CreateMap<UpdateViewModel, Model>(MemberList.Source)
.ForSourceMember(x => x.LastName, opt => opt.Ignore())
....
where I have ignored every single source member (including the one that shows up as PropertyMap in the exception - it happens to be a collection like many other properties in my code that are succesfully mapping) and still get it - despite every single member being set to ignore.
This is the only mapping - of dozens - that is causing a problem, and again there is no issue before upgrading to version 7.0.0
I had originally opened this issue in Automapper https://github.com/AutoMapper/AutoMapper/issues/2666 but issue was closed and it was recommended it be opened here instead
Perhaps this is covered by https://github.com/AutoMapper/AutoMapper.Collection/issues/88?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Try the MyGet for the 7.0.0 fix. Just use Automapper.Collections and allow pre-releases
When did you plan to release the new version?