HandleProcessCorruptedStateExceptionsAttribute HandleProcessCorruptedStateExceptionsAttribute HandleProcessCorruptedStateExceptionsAttribute HandleProcessCorruptedStateExceptionsAttribute Class


启用托管代码以处理用于指示损坏的进程状态的异常。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 仅在同时HandleProcessCorruptedStateExceptionsAttribute具有和SecurityCriticalAttribute属性的方法中, 将损坏的进程状态异常传递给适用的异常子句。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. 这将确保在没有或HandleProcessCorruptedStateExceptionsAttribute SecurityCriticalAttribute属性的情况下, 将损坏状态异常传递给异常处理程序。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() HandleProcessCorruptedStateExceptionsAttribute() HandleProcessCorruptedStateExceptionsAttribute() HandleProcessCorruptedStateExceptionsAttribute()

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


Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Attribute)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Attribute)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
IsDefaultAttribute() IsDefaultAttribute() IsDefaultAttribute() IsDefaultAttribute()

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

(Inherited from Attribute)
Match(Object) Match(Object) Match(Object) Match(Object)

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

(Inherited from Attribute)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)


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

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

(Inherited from Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

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

(Inherited from Attribute)
_Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32)

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

(Inherited from Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

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

(Inherited from Attribute)


TypeId TypeId TypeId TypeId

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

(Inherited from Attribute)