System.TypeLoadException Class

public class TypeLoadException : SystemException

Base Types

Object
  Exception
    SystemException
      TypeLoadException

Assembly

mscorlib

Library

RuntimeInfrastructure

Summary

Represents the error that occurs when the system cannot load a Type.

Description

TypeLoadException is thrown when the system cannot load a Type , or cannot locate the assembly that contains the Type .

[Note: The following CIL instructions throw TypeLoadException and set the TypeName property via some unspecified mechanism:

]

See Also

System Namespace

Members

TypeLoadException Constructors

TypeLoadException() Constructor
TypeLoadException(System.String) Constructor
TypeLoadException(System.String, System.Exception) Constructor

TypeLoadException Properties

TypeLoadException.Message Property
TypeLoadException.TypeName Property


TypeLoadException() Constructor

public TypeLoadException();

Summary

Constructs and initializes a new instance of the TypeLoadException class.

Description

This constructor initializes the System.TypeLoadException.Message property of the new instance to a system-supplied message that describes the error, such as "A failure has occurred while loading a type." This message takes into account the current system culture.

The System.TypeLoadException.TypeName property is initialized to System.String.Empty, and the System.TypeLoadException.InnerException property is initialized to null .

See Also

System.TypeLoadException Class, System Namespace

TypeLoadException(System.String) Constructor

public TypeLoadException(string message);

Summary

Constructs and initializes a new instance of the TypeLoadException class.

Parameters

message
A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.

Description

This constructor initializes the System.TypeLoadException.Message property of the new instance using message. If message is null , the System.TypeLoadException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.

The System.TypeLoadException.TypeName property is initialized to System.String.Empty, and the System.TypeLoadException.InnerException property is initialized to null .

See Also

System.TypeLoadException Class, System Namespace

TypeLoadException(System.String, System.Exception) Constructor

public TypeLoadException(string message, Exception inner);

Summary

Constructs and initializes a new instance of the TypeLoadException class.

Parameters

message
A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
inner
An instance of Exception that is the cause of the current exception. If inner is non-null, then the current Exception was raised in a catch block handling inner.

Description

This constructor initializes the System.TypeLoadException.Message property of the new instance using message and the System.TypeLoadException.InnerException property using inner. If message is null , the System.TypeLoadException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.

The System.TypeLoadException.TypeName property is initialized to System.String.Empty.

For more information on inner exceptions, see System.Exception.InnerException.

See Also

System.TypeLoadException Class, System Namespace

TypeLoadException.Message Property

public override string Message { get; }

Summary

Gets the error message for this exception.

Property Value

A String containing a message that describes the error.

Description

This property is read-only.

[Note: This property overrides System.Exception.Message .]

If no message was supplied to the constructor for the current instance, the system supplies a default message that is formatted using the current system culture. The system-supplied message includes the fully qualified name of the type that failed to load, and the string obtained by invoking System.Reflection.Assembly.ToString on the assembly that referenced the type. For a type named MyTypes.MyClass, referenced by an assembly with the simple name MyAssembly , the message might read as follows:

Could not load type MyTypes.MyClass from assembly MyAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.

See Also

System.TypeLoadException Class, System Namespace

TypeLoadException.TypeName Property

public string TypeName { get; }

Summary

Gets the fully qualified name of the Type that failed to load.

Property Value

A String containing the fully qualified type name.

Description

This property is read-only.

See Also

System.TypeLoadException Class, System Namespace