mscorlib 4.0.0.0 System.TypeLoadException System.Runtime.InteropServices.ComVisible(true)

is thrown when a method attempts to cast an object to a type that is not accessible from the method. For example, an anonymously hosted dynamic method cannot access a security-critical type because the method is transparent. If the method contains a instruction that casts an object to a security-critical type, or to a generic type that has a security-critical type as one of its type parameters, is thrown by the JIT compiler.

Similarly, is thrown for a dynamic method that uses an internal type from another assembly. A method might not have access to its containing type, its return type, or one of its parameter types.

The exception that is thrown when a method attempts to use a type that it does not have access to.

- Constructor
  4.0.0.0

  This constructor initializes the property of the new instance to a system-supplied message that describes the error, such as "Attempt to access the type failed." This message takes the current system culture into account.

  The following table shows the initial property values for an instance of .

  Property

  Value

  A null reference (Nothing in Visual Basic).

  The localized error message string.

  Initializes a new instance of the class with a system-supplied message that describes the error.

- Constructor
  4.0.0.0

  The following table shows the initial property values for an instance of .

  Property

  Value

  A null reference (Nothing in Visual Basic).

  The error message string specified in .

  Initializes a new instance of the class with a specified message that describes the error.

  The message that describes the exception. The caller of this constructor must ensure that this string has been localized for the current system culture.
- Constructor
  4.0.0.0

  This constructor is called during deserialization to reconstitute the exception object that was transmitted over a stream. For more information, see XML and SOAP Serialization.

  Initializes a new instance of the class with serialized data.

  The object that holds the serialized data.
  The contextual information about the source or destination.
- Constructor
  4.0.0.0

  An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the property. The property returns the same value that is passed into the constructor, or null if the property does not supply the inner exception value to the constructor.

  The following table shows the initial property values for an instance of .

  Property

  Value

  A null reference (Nothing in Visual Basic).

  The error message string specified in .

  Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception.

  The message that describes the exception. The caller of this constructor must ensure that this string has been localized for the current system culture.
  The exception that is the cause of the current exception. If the parameter is not null, the current exception is raised in a catch block that handles the inner exception.