C
C#11mo ago
Jibz

❔ BinaryFormatter.Serialize(Stream, object)' is obsolete, What do I use instead?

I'm learning serialization in C# but it says binary formatters are obsolete. what should i use?
6 Replies
chef drone builder
You could use a Non Binary Seriaizer
chef drone builder
Breaking change: BinaryFormatter serialization methods are obsolete...
Learn about the .NET 5 breaking change in core .NET libraries where serialize and deserialize methods on BinaryFormatter, Formatter, and IFormatter are obsolete.
Angius
Angius11mo ago
Binary serialization is dangerous JSON would be best Or if you insist on a binary format, Protobuf
Accord
Accord11mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
GrabYourPitchforks
Very specifically, BinaryFormatter serialization is dangerous. There's nothing about the "binary" part of it that makes it dangerous. It's absolutely possible to have safe binary formats (protobuf, as you suggested) - and it's absolutely possible to have dangerous text formats (NetDataContractSerializer, which is XML-based). BinaryFormatter absolutely has its problems, but it's not the "binary" part that makes it dangerous. (And yes, I know I'm responding to this well after the fact - just commenting in case people find it while searching.)
Accord
Accord10mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ SingalR Hub Bearer Token AuthI am failing to see a simple way to add bearer token auth to a SignalR hub. The instructions on how ❔ DDD: How to apply a Domain specification on a Infrastructure EF Core?Hello everyone, I'm currently working on an app utilizing `DDD (Domain Driven Design)` and `Microse❔ WPF Change ViewsIm trying to switch views with MVVM pattern❔ Executing a method every n seconds but only during certain conditionsWhat would be the best way to do this? The easiest way I can think of would be: ```cs Task.Run(MainA❔ GtkSharp: Creating a GClosureSimply put, I am trying to complete the following code: ```csharp AccelGroup binds = new AccelGroup(✅ Confused by constant errors regarding class extension.Hi all, for my uni course, I need to code a game. I have chosen TicTacToe, but it needs to use diffe❔ How would you embed a Git commit hash in an assembly?I want to stamp a commit hash into a binary so I can display it in the UI. I'm fine with pulling stu❔ Is it possible to run integration tests with typescript as client and .net api as server?My hope is to test a client written in typescript which calls a .net api in the same solution.✅ .csproj – how to generate nodes dynamically by iterating over a string array ?how can i generate xml code in the .csproj file? i dont want to repeat my actions 10000 times... so ❔ AWS multiple file upload Using API in Razor PageI am trying to send the API request from the razor page. The Endpoint is not hitting the API Control