HandleProcessCorruptedStateExceptionsAttribute 类


启用托管代码以处理用于指示损坏的进程状态的异常。Enables managed code to handle exceptions that indicate a corrupted process state.

public ref class HandleProcessCorruptedStateExceptionsAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public sealed class HandleProcessCorruptedStateExceptionsAttribute : Attribute
type HandleProcessCorruptedStateExceptionsAttribute = class
    inherit Attribute
Public NotInheritable Class HandleProcessCorruptedStateExceptionsAttribute
Inherits Attribute


损坏的进程状态异常是指示进程状态已损坏的异常。Corrupted process state exceptions are exceptions that indicate that the state of a process has been corrupted. 建议不要在此状态下执行应用程序。We do not recommend executing your application in this state.

默认情况下,公共语言运行时(CLR)不会将这些异常传递给托管代码,也不会为其调用 try/catch 块(以及其他异常处理子句)。By default, the common language runtime (CLR) does not deliver these exceptions to managed code, and the try/catch blocks (and other exception-handling clauses) are not invoked for them. 如果你完全确信要保持对这些异常的处理,则必须将 HandleProcessCorruptedStateExceptionsAttribute 特性应用于要执行的异常处理子句的方法。If you are absolutely sure that you want to maintain your handling of these exceptions, you must apply the HandleProcessCorruptedStateExceptionsAttribute attribute to the method whose exception-handling clauses you want to execute. CLR 仅在同时具有 HandleProcessCorruptedStateExceptionsAttributeSecurityCriticalAttribute 属性的方法中,将损坏的进程状态异常传递给适用的异常子句。The CLR delivers the corrupted process state exception to applicable exception clauses only in methods that have both the HandleProcessCorruptedStateExceptionsAttribute and SecurityCriticalAttribute attributes.

还可以将<legacyCorruptedStateExceptionsPolicy >元素添加到应用程序的配置文件中。You can also add the <legacyCorruptedStateExceptionsPolicy> element to your application's configuration file. 这将确保在没有 HandleProcessCorruptedStateExceptionsAttributeSecurityCriticalAttribute 属性的情况下,将损坏状态异常发送到异常处理程序。This will ensure that corrupted state exceptions are delivered to your exception handlers without the HandleProcessCorruptedStateExceptionsAttribute or SecurityCriticalAttribute attribute. 此配置元素对在 .NET Framework 4.NET Framework 4 之前的版本中编译但在 .NET Framework 4.NET Framework 4 或更高版本中运行的应用程序不起作用;将继续为这些应用程序提供损坏状态异常。This configuration element has no effect on applications that were compiled in versions previous to the .NET Framework 4.NET Framework 4 but are running in the .NET Framework 4.NET Framework 4 or later; corrupted state exceptions will continue to be delivered for those applications. 当在部分受信任或透明的代码中遇到 HandleProcessCorruptedStateExceptionsAttribute 属性时,将忽略该属性,因为受信任的主机不允许不受信任的加载项捕获和忽略这些严重异常。The HandleProcessCorruptedStateExceptionsAttribute attribute is ignored when it is encountered in partially trusted or transparent code, because a trusted host should not allow an untrusted add-in to catch and ignore these serious exceptions.

有关损坏的进程状态异常的详细信息,请参阅博客中的 CLR 内部的处理损坏状态异常的条目。For more information about corrupted process state exceptions, see the entry Handling Corrupted State Exceptions in the CLR Inside Out blog.



初始化 HandleProcessCorruptedStateExceptionsAttribute 类的新实例。Initializes a new instance of the HandleProcessCorruptedStateExceptionsAttribute class.



在派生类中实现时,获取此 Attribute 的唯一标识符。When implemented in a derived class, gets a unique identifier for this Attribute.

(继承自 Attribute)



返回一个值,该值指示此实例是否与指定的对象相等。Returns a value that indicates whether this instance is equal to a specified object.

(继承自 Attribute)

返回此实例的哈希代码。Returns the hash code for this instance.

(继承自 Attribute)

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)

在派生类中重写时,指示此实例的值是否是派生类的默认值。When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(继承自 Attribute)

当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(继承自 Attribute)

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)


_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。Maps a set of names to a corresponding set of dispatch identifiers.

(继承自 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。Retrieves the type information for an object, which can be used to get the type information for an interface.

(继承自 Attribute)

检索对象提供的类型信息接口的数量(0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。Provides access to properties and methods exposed by an object.

(继承自 Attribute)