SEHException 类

表示结构化异常处理程序 (SEH) 错误。

**命名空间:**System.Runtime.InteropServices
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Class SEHException
    Inherits ExternalException
用法
Dim instance As SEHException
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public class SEHException : ExternalException
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public ref class SEHException : public ExternalException
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public class SEHException extends ExternalException
SerializableAttribute 
ComVisibleAttribute(true) 
public class SEHException extends ExternalException

备注

SEHException 类处理从非托管代码引发的、但尚未映射到另一个 .NET Framework 异常的 SEH 错误。SEHException 类还响应 HRESULT E_FAIL(它具有值 0x80004005)。

.NET Framework 经常会遇到非托管 SEH 异常,这些异常自动映射到托管等效项。例如,STATUS_NO_MEMORY SEH 异常自动映射到 OutOfMemoryException 类,而 STATUS_ACCESS_VIOLATION SEH 异常自动映射到 NullReferenceException 类。但是默认情况下,任何未自动映射到特定异常的 SEH 异常将映射到 SEHException 类。

有关 SEH 异常的更多信息,请参见位于 https://www.microsoft.com/china/msdn 上的非托管异常文档。

请注意,SEHException 类不会导致对非托管 C++ 异常析构函数的调用。若要确保对非托管 C++ 异常析构函数的调用,请使用 catch 块中的以下语法。

[Visual Basic]

Catch

' Handle catch here.

End Try

[C#]

catch

{

// Handle catch here.

}

[C++]

catch(…)

{

// Handle catch here.

}

继承层次结构

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

线程安全

此类型的任何公共静态(Visual Basic 中的 Shared)成员都是线程安全的,但不保证所有实例成员都是线程安全的。

平台

Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

SEHException 成员
System.Runtime.InteropServices 命名空间
Exception

其他资源

处理和引发异常
如何:映射 HRESULT 和异常