MissingRuntimeArtifactException in Universal Windows sample

By : Tony M
Source: Stackoverflow.com

I have attached the sample in the following location


And I have the following problems in the above sample.

  1. When changing IEnumerable to IQueryable using AsQuerable method, the MissingRuntimeArtifactException is thrown. This problem has been solved when using the below line in rd.xml file in App1

<Namespace Name="System.Linq" Dynamic ="Required All" Serialize="Required All" XmlSerializer="Required All"   />

My question is how to include rd.xml file in CustomButton class library? If I add manually by adding new xml file in CustomButton, its not working when I run App1 with CustomButton dll. How to resolve this?

  1. While using Expressions in IQueryable extension method(Count()) the same exception has been thrown. Please suggest any solution for this issue.


Antony Raj

By : Tony M

If you use the template for Class Library (Universal Windows) it will do two things that you'll find beneficial.

  1. It will generate a .rd.xml template
  2. At build time, it will embed this xml file into your library as a resource

When compiling applications to Native code the .Net Native toolss (ilc.exe) will look for all files in the project that match *.rd.xml and all resources in libraries. Embedding this way makes deployment of your library much simpler.

If you'd prefer to not embed this asset it'll be up to you to make sure the file lives next to your assembly via whatever deployment mechanism you prefer. (Sometimes it's included in Nuget package and just copied around.)

Also, I'd highly advise against using the directive you have above. In particular the portions of it that are Serialize="Required All" and XmlSerialize="Required All". Adding those to the directive will great bloat the amount of serialization code generated and it's pretty unlikely you actually need to XmlSerialize ALL of the types in System.Linq.

This video can help you solving your question :)
By: admin