System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute Class

Enables managed code to handle exceptions that indicate a corrupted process state.

See Also: HandleProcessCorruptedStateExceptionsAttribute Members


[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public sealed class HandleProcessCorruptedStateExceptionsAttribute : 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.

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. If you are absolutely sure that you want to maintain your handling of these exceptions, you must apply the System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute attribute to the method whose exception-handling clauses you want to execute. The CLR delivers the corrupted process state exception to applicable exception clauses only in methods that have both the System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute and System.Security.SecurityCriticalAttribute attributes.

You can also add the <legacyCorruptedStateExceptionsPolicy> element to your application's configuration file. This will ensure that corrupted state exceptions are delivered to your exception handlers without the System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute or System.Security.SecurityCriticalAttribute attribute. This configuration element has no effect on applications that were compiled in versions previous to the net_v40_long but are running in the net_v40_short or later; corrupted state exceptions will continue to be delivered for those applications. The System.Runtime.ExceptionServices.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.

For more information about corrupted process state exceptions, see the entry tp:// in the CLR Inside Out blog.


Namespace: System.Runtime.ExceptionServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: