MissingRuntimeArtifactException Class (.NET Native)

.NET for Windows apps for Windows 10, .NET Native only

The exception that is thrown when metadata for a type or type member is available but its implementation has been removed.

Namespace: System.Reflection

Important

The MissingRuntimeArtifactException class is intended solely for internal use by the .NET Native tool chain. It is not intended for use in third-party code, nor should you handle the exception in your application code. Instead, you eliminate the exception by adding entries to your runtime directives file. For more information, see the Remarks section.

Syntax

internal sealed class MissingRuntimeArtifactException : MemberAccessException

Note that the MissingRuntimeArtifactException class derives from MemberAccessException.

The MissingRuntimeArtifactException class has the following members:

Constructors

Constructor Description
public MissingRuntimeArtifactException() Initializes a new instance of the MissingRuntimeArtifactException class by using a system-supplied message that describes the error.

This constructor is for internal use by the .NET Native tool chain only.
public MissingRuntimeArtifactException(String message) Initializes a new instance of the MissingRuntimeArtifactException class with a specified error message.

This constructor is for internal use by the .NET Native tool chain only.

Properties

Property Description
public IDictionary Data { get; } Gets a collection of key/value pairs that provide additional user-defined information about the exception. (Inherited from System.Exception.)
public string HelpLink { get; set; } Gets or sets a link to the help file associated with this exception. (Inherited from System.Exception.)
public int HResult { get; protected set; } Gets or sets the HRESULT, a coded numeric value that is assigned to a specific exception. (Inherited from System.Exception.)
public Exception InnerException { get; } Gets the exception that caused the current exception. (Inherited from System.Exception.)
public string Message { get; } Gets a message that describes the current exception. (Inherited from System.Exception.)
public string Source { get; set; } Gets or sets the name of the application or object that caused the error. (Inherited from System.Exception.)
public string StackTrace { get; } Gets a string representation of the immediate frames on the call stack. (Inherited from System.Exception.)
public MethodBase TargetSite { get; } Gets the method that threw the current exception. (Inherited from System.Exception.)

Methods

Method Description
public bool Equals(Object obj) Determines whether the specified object is equal to the current object. (Inherited from Object.)
protected void Finalize() Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
public Exception GetBaseException() Returns the exception that is the root cause of one or more subsequent exceptions. (Inherited from System.Exception.)
public int GetHashCode() Returns a hash code for a MissingRuntimeArtifactException instance. (Inherited from Object.)
public void GetObjectData(SerializationInfo info, StreamingContext context) Sets a SerializationInfo object with information about the exception. (Inherited from System.Exception.)
public Type GetType() Gets the runtime type of the current instance. (Inherited from System.Exception.)
protected Object MemberwiseClone() Creates a shallow copy of the current object. (Inherited from Object.)
public string ToString() Returns the string representation of the current exception. (Inherited from System.Exception.)

Events

Event Description
protected event EventHandler<SafeSerializationEventArgs> SerializeObjectState Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception. (Inherited from System.Exception.)

Usage Details

The MissingRuntimeArtifactException exception is thrown when an attempt is made to instantiate a type or invoke a type member and, although the type or member's metadata is present, its implementation has been removed.

Whether metadata and the implementation code to dynamically execute a method are available to an app at run time is defined by the runtime directives (XML configuration) file, *.rd.xml. To prevent your app from throwing this exception, you must modify *.rd.xml to ensure that the metadata needed by a type or type member is present at run time. For information about the format of the *.rd.xml file, see Runtime Directives (rd.xml) Configuration File Reference.

Important

Because this exception indicates that the implementation code needed by your application isn't available at run time, you shouldn't handle this exception in a try/catch block. Instead, you should diagnose the cause of the exception and eliminate it by using a runtime directives file. Typically, you eliminate this exception by specifying the appropriate Activate or Dynamic policy for a program element in the runtime directives file (*.rd.xml file). To get the entry that you can add to your runtime directives file that eliminates the exception, you can use one of two troubleshooters:

The MissingRuntimeArtifactException class contains no unique members; all of its members are inherited from its base class, MemberAccessException.

See also