public class TypeLoadException : SystemException
Object
Exception
SystemException
TypeLoadException
mscorlib
RuntimeInfrastructure
Represents the error that occurs when the system cannot load a Type.
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:
]
- box
- castclass
- cpobj
- isinst
- ldobj
- mkrefany
- refanyval
- stobj
- unbox
System Namespace
TypeLoadException Constructors
TypeLoadException() Constructor
TypeLoadException(System.String) Constructor
TypeLoadException(System.String, System.Exception) Constructor
TypeLoadException Properties
TypeLoadException.Message Property
TypeLoadException.TypeName Property
public TypeLoadException();
Constructs and initializes a new instance of the TypeLoadException class.
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
.
System.TypeLoadException Class, System Namespace
public TypeLoadException(string message);
Constructs and initializes a new instance of the TypeLoadException class.
- 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.
This constructor initializes the System.TypeLoadException.Message property of the new instance using message. If message isnull
, 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
.
System.TypeLoadException Class, System Namespace
public TypeLoadException(string message, Exception inner);
Constructs and initializes a new instance of the TypeLoadException class.
- 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.
This constructor initializes the System.TypeLoadException.Message property of the new instance using message and the System.TypeLoadException.InnerException property using inner. If message isnull
, 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.
System.TypeLoadException Class, System Namespace
public override string Message { get; }
Gets the error message for this exception.
A String containing a message that describes the error.
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.
System.TypeLoadException Class, System Namespace
public string TypeName { get; }
Gets the fully qualified name of the Type that failed to load.
A String containing the fully qualified type name.
This property is read-only.
System.TypeLoadException Class, System Namespace