mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.5000.0 2.0.0.0 4.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Runtime.InteropServices.ExternalException System.Runtime.InteropServices.ComVisible(true)

The common language runtime transforms well-known HRESULTs to.NET exceptions, enabling COM objects to return meaningful error information to managed clients. The HRESULT to exception mapping also works in the other direction by returning specific HRESULTs to unmanaged clients. For mapping details, see [<topic://cpconhresultsexceptions>].

When the runtime encounters an unfamiliar HRESULT (an HRESULT that lacks a specific, corresponding exception), it throws an instance of the class. This all-purpose exception exposes the same members as any exception, and includes a public ErrorCode property that contains the HRESULT returned by the callee. If an error message is available to the runtime (obtained from the IErrorInfo interface or the Err object in Visual Basic, or in some cases from the operating system), the message is returned to the caller. However, if the COM component developer fails to include an error message, the runtime returns the eight-digit HRESULT in place of a message string. Having an HRESULT allows the caller to determine the cause of the generic exception.

Although you can use the class to return specific HRESULTs to unmanaged clients, throwing a specific.NET exception is better than using a generic exception. Consider that managed clients as well as unmanaged clients can use your.NET object, and throwing an HRESULT to a managed caller is less comprehendible than throwing an exception.

The exception that is thrown when an unrecognized HRESULT is returned from a COM method call.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  inherits from . The following table shows how this constructor sets the properties of the object.

  Property

  Value

  null.

  A localized error message string.

  Initializes a new instance of the class with default values.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  inherits from . The following table shows how this constructor sets the properties of the object.

  Property

  Value

  null

  Initializes a new instance of the class with a specified message.

  The message that indicates the reason for the exception.
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  This constructor is called during deserialization to reconstitute the exception object transmitted over a stream. For more information, see [<topic://cpconSerialization>].

  inherits from .

  Initializes a new instance of the class from serialization data.

  The object that holds the serialized object data.
  The object that supplies the contextual information about the source or destination.
- Constructor
  1.0.5000.0
  2.0.0.0
  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 how this constructor sets the properties of the object.

  Property

  Value

  The inner exception reference.

  The error message string.

  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 error message that explains the reason for the exception.
  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.
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  This constructor sets the base message with the error code.

  inherits from . The following table shows how this constructor sets the properties of the object.

  Property

  Value

  null

  Initializes a new instance of the class with a specified message and error code.

  The message that indicates the reason the exception occurred.
  The error code (HRESULT) value associated with this exception.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added.

  Converts the contents of the exception to a string.

  A string containing the , , , and properties of the exception.