dotnet / dotnet/announcements

.NET 8 reaches next step in deprecation of `BinaryFormatter`

Open
#284 0 comments 0 reactions 0 assignees View on GitHub
.NET 8.0 Breaking Change PSA
Dominant language
No language data
Stars
1.4k
Forks
53
PR merge metrics
No merged PRs in 30d

Description

Starting with .NET 8, [`BinaryFormatter` throws `NotSupportedException`][net80-change] across nearly all project types, including console applications (except Windows Forms and WPF). This run-time change is the next stage of the [`BinaryFormatter` obsoletion plan][bf-deprecation], in which `BinaryFormatter` will eventually be removed from .NET.

> [!NOTE]
> Should you need to continue using `BinaryFormatter`, you can set a compatibility switch in your project file to re-enable `BinaryFormatter` functionality. See the [.NET 8 breaking change notification][net80-change] for more details.

> [!NOTE]
> Please note that there is no change [planned][bf-deprecation] for .NET Framework.

The reason is that `BinaryFormatter` has many [security considerations][bf-security], which makes the API inherently prone to security issues.

[net80-change]: https://learn.microsoft.com/en-us/dotnet/core/compatibility/serialization/8.0/binaryformatter-disabled
[bf-deprecation]: https://github.com/dotnet/designs/blob/main/accepted/2020/better-obsoletion/binaryformatter-obsoletion.md
[bf-security]: https://learn.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.