question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automapper fails when using .NET Native

See original GitHub issue

Running a UWP project compiled with .NET Native tool chain causes automapper fail with the following exception:

Exception thrown: 'System.Reflection.MissingRuntimeArtifactException' in System.Private.Reflection.Core.dll
Additional information: MakeGenericMethod() cannot create this generic method instantiation because the instantiation was not metadata-enabled: 'System.Linq.Enumerable.SingleOrDefault<System.Char>(System.Collections.Generic.IEnumerable<System.Char>)' For more information, please visit http://go.microsoft.com/fwlink/?LinkID=616868

As far I saw in the call stack, the exception was produced in the method BuildPublicNoArgExtensionMethods.

Reading some of the documentation regarding .NET Native and reflection (APIs That Rely on Reflection), it states that you must supply a specific runtime directive when using MakeGenericMethod, but it hasn’t working on my side.

I wonder if this is an issue that automapper can solve by itself by defining its own .rd.xml file, or if exists another workaround that I can use to avoid this error.

Cheers.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:33 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
jbogardcommented, Oct 6, 2015

@JamesNK Are you kidding me?!?

0reactions
lock[bot]commented, May 7, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AutoMapper doesn't work in asp net core 5.0.2
The problem is that you are not injecting automapper in a good way. follow the following steps: Install the nuget package AutoMapper.Extensions.
Read more >
Is anyone else having issues with AutoMapper and .Net 7?
I keep getting this error at run time ArgumentException: Incorrect number of arguments supplied for call to method 'Dto get_Item(Int32)' ...
Read more >
The reasons behind why I don't use AutoMapper.
I've encountered cases when AutoMapper transforms simple thing like mapping values from object to other into a really complex problem, which ...
Read more >
Moving to Windows 10: AutoMapper and .NET Native
NET Native sometimes gives you errors you didn't have in debug builds. But quite often the errors will pop up when you try...
Read more >
c# - Am I wrong in thinking that needing something like ...
Automapper is an "object-object mapper" for .Net, which means copying objects from a class into another class that represents the same thing.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found