Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Breaking change]: BinaryFormatter disabled across almost all project types by default #34891

Closed
1 of 3 tasks
GrabYourPitchforks opened this issue Apr 5, 2023 · 1 comment · Fixed by #35217
Closed
1 of 3 tasks
Assignees
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 8 Work items for the .NET 8 release doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 📌 seQUESTered Identifies that an issue has been imported into Quest.

Comments

@GrabYourPitchforks
Copy link
Member

GrabYourPitchforks commented Apr 5, 2023

Description

Beginning with .NET 8 Preview 4, the BinaryFormatter.Serialize and BinaryFormatter.Deserialize methods will throw NotSupportedException across nearly all project types, including console applications.

A compatibility switch exists for applications which need to reenable BinaryFormatter behavior. See below for details.

Version

.NET 8 Preview 4

Previous behavior

In .NET 7, the BinaryFormatter.Serialize and BinaryFormatter.Deserialize methods were marked obsolete as error. However, if an application suppressed the obsoletion, the methods could still be called and would still function properly in most project types (excluding aspnet, wasm, and MAUI). For example, the APIs would function properly within a console app.

New behavior

In .NET 8 Preview 4, these methods will throw NotSupportedException at runtime across all project types except WinForms and WPF. The APIs continue to remain obsolete-as-error across all project types, including WinForms and WPF.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
  • Behavioral change: Existing binaries may behave differently at run time.

Reason for change

This is the next stage of the BinaryFormatter obsoletion plan, preparing for BinaryFormatter's eventual removal from .NET. See earlier breaking change notifications for additional context:

Recommended action

The best course of action is to migrate away from BinaryFormatter due to its security and reliability flaws.

However, should you need to continue using BinaryFormatter, please review the Recommended action section of the .NET 7 breaking change notification. That document provides a compatibility switch that can be set in your application's project file to reenable BinaryFormatter functionality. That compatibility switch continues to be honored in .NET 8.

Feature area

Serialization

Affected APIs


Associated WorkItem - 91247

@GrabYourPitchforks GrabYourPitchforks added doc-idea Indicates issues that are suggestions for new topics [org][type][category] breaking-change Indicates a .NET Core breaking change Pri1 High priority, do before Pri2 and Pri3 labels Apr 5, 2023
@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label Apr 5, 2023
@gewarren gewarren removed the ⌚ Not Triaged Not triaged label Apr 5, 2023
@gewarren gewarren added the 🏁 Release: .NET 8 Work items for the .NET 8 release label Apr 5, 2023
@ghost ghost added the in-pr This issue will be closed (fixed) by an active pull request. label May 2, 2023
@gewarren gewarren moved this from 🔖 Ready to 🏗 In progress in dotnet/docs May 2023 sprint May 2, 2023
@gewarren gewarren moved this from 🏗 In progress to 👀 In review in dotnet/docs May 2023 sprint May 2, 2023
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in .NET 8.0 work items May 16, 2023
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in dotnet/docs May 2023 sprint May 16, 2023
@ghost ghost removed the in-pr This issue will be closed (fixed) by an active pull request. label May 16, 2023
@gewarren gewarren added the 🗺️ reQUEST Triggers an issue to be imported into Quest. label May 18, 2023
@github-actions github-actions bot added 📌 seQUESTered Identifies that an issue has been imported into Quest. and removed 🗺️ reQUEST Triggers an issue to be imported into Quest. labels May 19, 2023
@IS4Code
Copy link

IS4Code commented May 19, 2023

Not only is .NET Core still missing things present in .NET Framework, but now others are being removed. Lol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 8 Work items for the .NET 8 release doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 📌 seQUESTered Identifies that an issue has been imported into Quest.
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants