Starting with .NET 8, BinaryFormatter throws NotSupportedException 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, 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 for more details.
[!NOTE]
Please note that there is no change planned for .NET Framework.
The reason is that BinaryFormatter has many security considerations, which makes the API inherently prone to security issues.
Starting with .NET 8,
BinaryFormatter
throwsNotSupportedException
across nearly all project types, including console applications (except Windows Forms and WPF). This run-time change is the next stage of theBinaryFormatter
obsoletion plan, in whichBinaryFormatter
will eventually be removed from .NET.The reason is that
BinaryFormatter
has many security considerations, which makes the API inherently prone to security issues.