AutoMapper: Automapper fails when using .NET Native

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.

About this issue

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

Most upvoted comments

@JamesNK Are you kidding me?!?