MissingMetadataException troubleshooter

To make your app faster and smaller, the .NET Native compiler performs whole program optimizations that employ static analysis to model the program behavior. The optimizations are similar to those traditionally used when compiling languages like C++. One of the optimizations done by the .NET Native compiler is the removal of types, methods, constructors, properties, events, and fields that are not used.

Since reflection is dynamic in nature, not all reflection use can be determined statically at the time of compilation. Because .NET Native does not presently have a just-in-time compiler to compile the pieces that are missing, everything that can be accessed at runtime needs to be known at the time of compilation. Your app will encounter a MissingMetadataException or MissingRuntimeArtifactException if it attempts to use something that was removed.

If the use of reflection is not simple enough for the optimizer to see through, the .NET Native compiler needs your assistance in describing the use of reflection by means of a Runtime Directive.

I reflect on

A single method

Namespace qualified name of type containing the method:

Method name (without the '<' and '>'):

Comma-separated generic arguments to instantiate the method:


This preview shows you the runtime directive corresponding to the choices you made in the left column. If you're adding a directive to an existing RD.XML file, append the directives under the <Application> element to the <Application> element of the existing RD.XML.

If you are authoring an RD.XML for a library, replace <Application> with <Library> .