-3

I upgraded a .NET Core 2.1 app to .NET 7 and upgraded the AutoMapper version that was being used to the latest version.

I had to change the ResolveUsing calls to MapFrom as the earlier was not available in the new version of the AutoMapper.

Now when I run the app, I am getting the following error:

Error: Method not found: '!!1 AutoMapper.IMapper.Map(!!0)'.

I have found that it's happening to Methods that are using the automapper where it's using a custom method:

.ForMember(dest => dest.RoleName, opt => opt.MapFrom(src => CustomResolvers.GetRoleName(src)))

The above CustomResolvers is a static public class and GetRoleName is a static method. This was fine using ResolveUsing in the earlier version of automapper but changing to MapFrom, causes the above mentioned error.

Any help would be greatly appreciated. Thanks Angelo

3
  • I search about this error, In most cases it is caused by inappropriate version , But you are using the latest version... Commented Sep 15, 2023 at 2:11
  • which version of Automapper you are using? Commented Sep 15, 2023 at 5:46
  • Hi Jalpesh, its 12.0.1 Commented Sep 15, 2023 at 6:27

1 Answer 1

0

It was just that a project that I was referencing was using the Automapper and that had the older version of Automapper.

Once I updated the Automapper for that project, everything is fine.

Thanks Angelo

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.