Specifies whether the common language runtime allows managed code to catch access violations and other corrupted state exceptions.
The following sections describe attributes, child elements, and parent elements.
Specifies that the application will catch corrupting state exception failures such as access violations.
|The application will not catch corrupting state exception failures such as access violations. This is the default.|
|The application will catch corrupting state exception failures such as access violations.|
|The root element in every configuration file used by the common language runtime and .NET Framework applications.|
|Contains information about assembly binding and garbage collection.|
In the .NET Framework version 3.5 and earlier, the common language runtime allowed managed code to catch exceptions that were raised by corrupted process states. An access violation is an example of this type of exception.
Starting with the .NET Framework 4, managed code no longer catches these types of exceptions in
catch blocks. However, you can override this change and maintain the handling of corrupted state exceptions in two ways:
- Set the
true. This configuration setting is applied processwide and affects all methods.
- Apply the System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute attribute to the method that contains the exceptions
This configuration element is available only in the .NET Framework 4 and later.
The following example shows how to specify that the application should revert to the behavior before the .NET Framework 4, and catch all corrupting state exception failures.
<configuration> <runtime> <legacyCorruptedStateExceptionsPolicy enabled="true" /> </runtime> </configuration>