Compartir a través de


Clase SEHException

 

Representa errores de Control de excepciones estructurado (SEH).

Espacio de nombres:   System.Runtime.InteropServices
Ensamblado:  mscorlib (en mscorlib.dll)

Jerarquía de herencia

System.Object
  System.Exception
    System.SystemException
      System.Runtime.InteropServices.ExternalException
        System.Runtime.InteropServices.SEHException

Sintaxis

[SerializableAttribute]
[ComVisibleAttribute(true)]
public class SEHException : ExternalException
[SerializableAttribute]
[ComVisibleAttribute(true)]
public ref class SEHException : ExternalException
[<SerializableAttribute>]
[<ComVisibleAttribute(true)>]
type SEHException = 
    class
        inherit ExternalException
    end
<SerializableAttribute>
<ComVisibleAttribute(True)>
Public Class SEHException
    Inherits ExternalException

Constructores

Nombre Descripción
System_CAPS_pubmethod SEHException()

Inicializa una nueva instancia de la clase SEHException.

System_CAPS_protmethod SEHException(SerializationInfo, StreamingContext)

Inicializa una nueva instancia de la SEHException clase a partir de datos de serialización.

System_CAPS_pubmethod SEHException(String)

Inicializa una nueva instancia de la SEHException clase con un mensaje especificado.

System_CAPS_pubmethod SEHException(String, Exception)

Inicializa una nueva instancia de la clase SEHException con el mensaje de error especificado y una referencia a la excepción interna que representa la causa de esta excepción.

Propiedades

Nombre Descripción
System_CAPS_pubproperty Data

Obtiene una colección de pares clave-valor que proporcionan más información definida por el usuario sobre la excepción.(Heredado de Exception).

System_CAPS_pubproperty ErrorCode

Obtiene el elemento HRESULT del error.(Heredado de ExternalException).

System_CAPS_pubproperty HelpLink

Obtiene o establece un vínculo al archivo de ayuda asociado a esta excepción.(Heredado de Exception).

System_CAPS_pubproperty HResult

Obtiene o establece HRESULT, un valor numérico codificado que se asigna a una excepción específica.(Heredado de Exception).

System_CAPS_pubproperty InnerException

Obtiene la instancia Exception que produjo la excepción actual.(Heredado de Exception).

System_CAPS_pubproperty Message

Obtiene un mensaje que describe la excepción actual.(Heredado de Exception).

System_CAPS_pubproperty Source

Devuelve o establece el nombre de la aplicación o del objeto que generó el error.(Heredado de Exception).

System_CAPS_pubproperty StackTrace

Obtiene una representación de cadena de los marcos inmediatos en la pila de llamadas.(Heredado de Exception).

System_CAPS_pubproperty TargetSite

Obtiene el método que produjo la excepción actual.(Heredado de Exception).

Métodos

Nombre Descripción
System_CAPS_pubmethod CanResume()

Indica si la excepción puede recuperarse y si el código puede continuar ejecutándose desde el punto en el que se produjo la excepción.

System_CAPS_pubmethod Equals(Object)

Determina si el objeto especificado es igual al objeto actual.(Heredado de Object).

System_CAPS_protmethod Finalize()

Permite que un objeto intente liberar recursos y realizar otras operaciones de limpieza antes de que sea reclamado por la recolección de elementos no utilizados.(Heredado de Object).

System_CAPS_pubmethod GetBaseException()

Cuando se invalida en una clase derivada, devuelve la clase Exception que representa la causa principal de una o más excepciones posteriores.(Heredado de Exception).

System_CAPS_pubmethod GetHashCode()

Sirve como la función hash predeterminada.(Heredado de Object).

System_CAPS_pubmethod GetObjectData(SerializationInfo, StreamingContext)

Cuando se invalida en una clase derivada, establece SerializationInfo con información sobre la excepción.(Heredado de Exception).

System_CAPS_pubmethod GetType()

Obtiene el tipo en tiempo de ejecución de la instancia actual.(Heredado de Exception).

System_CAPS_protmethod MemberwiseClone()

Crea una copia superficial del Object actual.(Heredado de Object).

System_CAPS_pubmethod ToString()

Devuelve una cadena que contiene el valor HRESULT del error.(Heredado de ExternalException).

Eventos

Nombre Descripción
System_CAPS_protevent SerializeObjectState

Ocurre cuando una excepción se serializa para crear un objeto de estado de excepción que contenga datos serializados sobre la excepción.(Heredado de Exception).

Comentarios

The T:System.Runtime.InteropServices.SEHException class handles SEH errors that are thrown from unmanaged code, but that have not been mapped to another .NET Framework exception. The T:System.Runtime.InteropServices.SEHException class also corresponds to the HRESULTE_FAIL (0x80004005).

The .NET Framework often encounters unmanaged SEH exceptions that are automatically mapped to managed equivalents. There are two common unmanaged SEH exceptions:

  • STATUS_NO_MEMORY exceptions are automatically mapped to the OutOfMemoryException class.

  • STATUS_ACCESS_VIOLATION exceptions are automatically mapped as follows:

    • If legacyNullReferencePolicy is applied, all access violations are mapped to the T:System.NullReferenceException class.

    • If the address at which the read/write was attempted is not in JIT-compiled code, the exception is mapped to the T:System.AccessViolationException class.

    • If the address at which the read/write was attempted is in JIT-compiled code, but it is not in the OS Null partition area, the exception is mapped to the T:System.AccessViolationException class.

    • If there is no legacyNullReferencePolicy, and the address at which the read/write was attempted is in JIT-compiled code and in the OS Null partition area, the exception is mapped to the T:System.NullReferenceException class.

Any SEH exception that is not automatically mapped to a specific exception is mapped to the T:System.Runtime.InteropServices.SEHException class by default.

For more information, search on "unmanaged exceptions" and "Structured Exception Handling" in the MSDN Library.

Note that the T:System.Runtime.InteropServices.SEHException class does not cause unmanaged C++ exception destructors to be called. To ensure that unmanaged C++ exception destructors are called, use the following syntax in the catch block.

[Visual Basic]

Catch 
     ' Handle catch here.
End Try

[C#]

catch
{
     // Handle catch here.
}

[C++]

catch(…)
{
     // Handle catch here.
} 

Información de versión

Plataforma universal de Windows
Disponible desde 8
.NET Framework
Disponible desde 1.1
Biblioteca de clases portable
Se admite en: plataformas portátiles de .NET
Silverlight
Disponible desde 2.0
Windows Phone Silverlight
Disponible desde 8.0
Windows Phone
Disponible desde 8.1

Seguridad para subprocesos

Cualquier miembro ( Compartido en Visual Basic) estático público de este tipo es seguro para subprocesos. No se garantiza que los miembros de instancia sean seguros para subprocesos.

Ver también

Exception
Espacio de nombres System.Runtime.InteropServices
Controlar y generar excepciones
How to: Map HRESULTs and Exceptions

Volver al principio