1
votes

i've a Xamarin.Forms application (UWP, using .Net Standard 2.0; Target Windows Version: 10 Fall Creators Update), that runs perfect without .NET Native toolchain. But when i enable the .Net Native Toolchain in the project settings, i retrieve exceptions during runtime:

System.Reflection.MissingRuntimeArtifactException: 'Cannot retrieve a MethodInfo for this delegate because the method it targeted (Void Xamarin.Forms.Platform.UWP.Platform.OnPageAlert(Object, AlertArguments)) was not enabled for metadata using the Dynamic attribute. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=616868'

It seems that i have to modify the default.rd.xml file in my UWP project. But i don't know exactly how to.

I added

<Type Name="Xamarin.Forms.Platform.UWP.Platform" Serialize="Required All" Dynamic="Required All"/>

but with no result. Same exception as before. Can someone give me the hint, how to solve that issue?

cheers, Chris

1
Not so sure whether it works but official doc shares something related to this kind of exception. See here What about give it a try?Barry Wang
You mean including the Assemby? I already did it with same result ;(The Chris

1 Answers

1
votes

I had the same error today in debug mode for ARM64, here .Net Native is always enabled, and here I added those entries to Default.rd.xml

<Type Name="Xamarin.Forms.Platform.UWP.WindowsPlatformServices" Serialize="Required All" />
<Type Name="Xamarin.Forms.Platform.UWP.Platform" Serialize="Required All" Dynamic="Required All">
  <MethodInstantiation Name="OnPageAlert" Arguments="System.Object" Dynamic="Required" />
</Type>

Now the error message was gone.