HandleProcessCorruptedStateExceptionsAttribute 类

定义

注意

Recovery from corrupted process state exceptions is not supported; HandleProcessCorruptedStateExceptionsAttribute is ignored.

启用托管代码以处理用于指示损坏的进程状态的异常。

public ref class HandleProcessCorruptedStateExceptionsAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public sealed class HandleProcessCorruptedStateExceptionsAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
[System.Obsolete("Recovery from corrupted process state exceptions is not supported; HandleProcessCorruptedStateExceptionsAttribute is ignored.", DiagnosticId="SYSLIB0032", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public sealed class HandleProcessCorruptedStateExceptionsAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
type HandleProcessCorruptedStateExceptionsAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
[<System.Obsolete("Recovery from corrupted process state exceptions is not supported; HandleProcessCorruptedStateExceptionsAttribute is ignored.", DiagnosticId="SYSLIB0032", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type HandleProcessCorruptedStateExceptionsAttribute = class
    inherit Attribute
Public NotInheritable Class HandleProcessCorruptedStateExceptionsAttribute
Inherits Attribute
继承
HandleProcessCorruptedStateExceptionsAttribute
属性

注解

损坏的进程状态异常是指示进程状态已损坏的异常。 不建议在此状态下执行应用程序。

默认情况下,公共语言运行时 (CLR) 不会将这些异常传递给托管代码,并且 try/catch 不会为其调用块 (和其他异常处理子句) 。 如果绝对确定要保持对这些异常的处理,则必须将 特性应用于 HandleProcessCorruptedStateExceptionsAttribute 要执行其异常处理子句的方法。 CLR 仅在同时 HandleProcessCorruptedStateExceptionsAttribute 具有 和 SecurityCriticalAttribute 属性的方法中将损坏的进程状态异常传递给适用的异常子句。

还可以将 <旧版CorruptedStateExceptionsPolicy> 元素添加到应用程序的配置文件中。 这将确保将损坏的状态异常传递到没有 HandleProcessCorruptedStateExceptionsAttributeSecurityCriticalAttribute 属性的异常处理程序。 此配置元素对在 .NET Framework 4 之前的版本中编译但在 .NET Framework 4 或更高版本中运行的应用程序没有影响;将继续为这些应用程序提供损坏状态异常。 在 HandleProcessCorruptedStateExceptionsAttribute 部分受信任的或透明代码中遇到该属性时,将忽略该属性,因为受信任的主机不应允许不受信任的外接程序捕获和忽略这些严重异常。

有关损坏进程状态异常的详细信息,请参阅 CLR Inside Out 博客中的 条目处理损坏的状态异常

仅限 .NET Core: 尽管 .NET Core 中存在此属性,但由于不支持从损坏的进程状态异常中恢复,因此会忽略此属性。 CLR 不会向托管代码提供损坏的进程状态异常。

构造函数

HandleProcessCorruptedStateExceptionsAttribute()
已过时.

初始化 HandleProcessCorruptedStateExceptionsAttribute 类的新实例。

属性

TypeId
已过时.

在派生类中实现时,获取此 Attribute 的唯一标识符。

(继承自 Attribute)

方法

Equals(Object)
已过时.

返回一个值,该值指示此实例是否与指定的对象相等。

(继承自 Attribute)
GetHashCode()
已过时.

返回此实例的哈希代码。

(继承自 Attribute)
GetType()
已过时.

获取当前实例的 Type

(继承自 Object)
IsDefaultAttribute()
已过时.

在派生类中重写时,指示此实例的值是否是派生类的默认值。

(继承自 Attribute)
Match(Object)
已过时.

当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。

(继承自 Attribute)
MemberwiseClone()
已过时.

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()
已过时.

返回表示当前对象的字符串。

(继承自 Object)

显式接口实现

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)
已过时.

将一组名称映射为对应的一组调度标识符。

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

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。

(继承自 Attribute)
_Attribute.GetTypeInfoCount(UInt32)
已过时.

检索对象提供的类型信息接口的数量(0 或 1)。

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

提供对某一对象公开的属性和方法的访问。

(继承自 Attribute)

适用于