Automapper fails when using .NET Native
See original GitHub issueRunning 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:
- Created 8 years ago
- Comments:33 (9 by maintainers)
Top 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 >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
@JamesNK Are you kidding me?!?
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.