This documentation is archived and is not being maintained.
TypeLoadException::Message Property
Visual Studio 2010
Gets the error message for this exception.
Assembly: mscorlib (in mscorlib.dll)
The following example attempts to load a non-existent type from the mscorlib assembly. The resulting exception is caught, and the TypeName and Message values are displayed. For this code example to run, you must provide the fully qualified assembly name. For information about how to obtain the fully qualified assembly name, see Assembly Names.
// Load the mscorlib assembly and get a reference to it. // You must supply the fully qualified assembly name for mscorlib.dll here. Assembly^ myAssembly = Assembly::Load( "Assembly text name, Version, Culture, PublicKeyToken" ); try { Console::WriteLine( "This program throws an exception upon successful run." ); // Attempt to load a non-existent type from an assembly. Type^ myType = myAssembly->GetType( "System.NonExistentType", true ); } catch ( TypeLoadException^ e ) { // Display the name of the Type that was not found. Console::WriteLine( "TypeLoadException: \n\tError loading the type '{0}' from the assembly 'mscorlib'", e->TypeName ); Console::WriteLine( "\tError Message = {0}", e->Message ); } catch ( Exception^ e ) { Console::WriteLine( "Exception: Error Message = {0}", e->Message ); }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: