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 type

There's no pattern. A single type with the following name:

All subtypes of a type

All types that implement following interface or derive from the following type:

All types with a custom attribute applied

All types that have the following attribute applied:

All types in a namespace

All types within the following namespace:

All types in an assembly

All types in the following assembly:

I use reflection to

Activate

Use Activator.CreateInstance or ConstructorInfo.Invoke to construct new instances of the type.

Access members or activate

Access methods, constructors, properties, fields and events on the type using reflection. This is a superset of Activation.

Serialize object graph

Access properties, fields, and constructors on the type and the types of the fields and properties recursively. This is a superset of Activation.

I reflect on

Public types and members only

Types and members that are not public won't be explictly included by this rule. They might be included by other rules.

Everything

Public, private and internal members and types will be included.

Preview

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> .