Skip to content

[Breaking change]: HandleProcessCorruptedStateExceptionsAttribute is marked as Obsolete #25450

@jeffhandley

Description

@jeffhandley

Description

The [HandleProcessCorruptedStateExceptions] attribute is marked as [Obsolete], beginning in .NET 6 RC1.

In .NET Framework, this attribute allowed managed code to opt into being able to handle exceptions related to corrupt process state. Even though this attribute exists in .NET Core, since the recovery from corrupted process state exceptions is not supported, this attribute is ignored. The CLR doesn't deliver corrupted process state exceptions to the managed code.

To reflect that this attribute is ignored, it has now been marked as [Obsolete] and its usage will result in a build warning. If a project's build is configured to treat warnings as errors, this will be a source-breaking change in .NET 6.

Version

.NET 6 RC1

Previous behavior

In .NET Framework, the [HandleProcessCorruptedStateExceptions] attribute could be applied, allowing the code to handle such exceptions.

In .NET Core and .NET 5, the attribute could be applied, but it was ignored by the runtime.

New behavior

Usage of this attribute will result in a build warning, or a build error if warnings are treated as errors.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
  • Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.

Reason for change

The attribute is ignored by the runtime and therefore should no longer be used.

Recommended action

Remove the [HandleProcessCorruptedStateExceptions] attribute from code. If that code was specifically handling corrupted process state exceptions, such code can also be removed as those exceptions can no longer be handled.

Feature area

Core .NET libraries

Affected APIs

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 6Issues and PRs for the .NET 6 releasebreaking-changeIndicates a .NET Core breaking changesource incompatibleSource code may encounter a breaking change in behavior when targeting the new version.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions