通过


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)]
[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)]
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}")>]
type HandleProcessCorruptedStateExceptionsAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
type HandleProcessCorruptedStateExceptionsAttribute = class
    inherit Attribute
Public NotInheritable Class HandleProcessCorruptedStateExceptionsAttribute
Inherits Attribute
继承
HandleProcessCorruptedStateExceptionsAttribute
属性

注解

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

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

还可以将 <legacyCorruptedStateExceptionsPolicy> 元素添加到应用程序的配置文件中。 这将确保将损坏的状态异常传递到异常处理程序,而无需 HandleProcessCorruptedStateExceptionsAttribute 使用或 SecurityCriticalAttribute 属性。 此配置元素对在 .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)

适用于