HandleProcessCorruptedStateExceptionsAttribute 類別


啟用 Managed 程式碼,以處理表示處理序損毀狀態的例外狀況。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
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
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.

根據預設,common language runtime (CLR) 不會將這些例外狀況傳遞至 managed 程式碼,且 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 SecurityCriticalAttributeThe 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 或更新版本中執行;已損毀的狀態例外狀況將繼續傳遞給這些應用程式。This configuration element has no effect on applications that were compiled in versions previous to the .NET Framework 4 but are running in the .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.

僅限 .Net Core: 雖然這個屬性存在於 .NET Core 中,因為不支援從損毀的進程狀態例外狀況復原,所以會忽略這個屬性。.NET Core only: Even though this attribute exists in .NET Core, since the recovery from corrupted process state exceptions is not supported, this attribute is ignored. CLR 不會將損毀的進程狀態例外狀況傳遞至 managed 程式碼。The CLR doesn't deliver corrupted process state exceptions to the managed code.



初始化 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)

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)


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

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。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)