The desktop app
remembers everything.
Window positions.
Saved filters.
Recent customers.
All of it written to disk
on exit,
read back at start up,
in one line each way:
var f = new BinaryFormatter();
var s = (Settings)f.Deserialize(stream);
It has worked
since .NET Framework.
It survived the move
to .NET Core.
It produced a warning,
SYSLIB0011,
and someone suppressed it.
Here is what changed.
From .NET 9,
BinaryFormatter
is still in the API,
but its implementation
is gone.
Serialize and Deserialize
throw
PlatformNotSupportedException.
Every time.
The old switch
that turned it back on
no longer does anything.
And this month
it stopped being optional.
Support for .NET 8
ended on 10 November 2026,
and .NET 9's ended
the same day.
The supported way forward
is .NET 10.
So the upgrade happens.
The app starts.
Loading the settings
throws.
And the code around it
was written years ago
for a corrupt file:
catch (Exception) {
settings = Settings.Default;
}
The user sees
a fresh install.
On exit
the defaults are saved
over the old file.
Every user's settings,
gone,
on the first launch
of the new version.
No crash report.
This is the shape
of where things are going.
Formats that can run code
on load
are being removed,
not just discouraged.
The warning period
is the migration window.
Here is what to do
before you upgrade.
Search the code
and the dependencies
for BinaryFormatter.
Old libraries
use it too.
Pick a format
that only carries data,
System.Text.Json
or similar.
To read files
users already have,
System.Formats.Nrbf
can decode the old format
without running it.
Ship one release
that reads the old file,
writes the new one,
and keeps the old one.
Microsoft also offers
an unsupported compatibility package
to bring the old behaviour back.
It is a bridge,
not a destination.
And stop catching everything
around a load.
A file you cannot read
is not the same
as a file that is not there.
– Serguey Asael Shinder
Top comments (0)