-
Notifications
You must be signed in to change notification settings - Fork 732
Removal of BinaryFormatter in .NET 8.0 #1779
Copy link
Copy link
Closed
Description
Description
Due to security issues, BinaryFormatter will be removed in .NET 8.0 and its Serialize and Deserialize methods are currently obsolete in .NET 5.0.
There is currently a single use of BinaryFormatter's Serialize and Deserialize methods:
fluentassertions/Src/FluentAssertions/ObjectAssertionsExtensions.cs
Lines 142 to 153 in 834a2db
| private static object CreateCloneUsingBinarySerializer(object subject) | |
| { | |
| using var stream = new MemoryStream(); | |
| var binaryFormatter = new BinaryFormatter | |
| { | |
| Binder = new SimpleBinder(subject.GetType()) | |
| }; | |
| binaryFormatter.Serialize(stream, subject); | |
| stream.Position = 0; | |
| return binaryFormatter.Deserialize(stream); | |
| } |
Although it's a long way off until BinaryFormatter is removed, I figured it'd be a good idea to bring some attention to it. I stumbled upon this while working on #1754.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done