JamesNK / Newtonsoft.Json

Json.NET is a popular high-performance JSON framework for .NET
https://www.newtonsoft.com/json
MIT License
10.64k stars 3.24k forks source link

.NET 9.0 and Binary Formatter being removed #2937

Closed bwilliams1 closed 3 months ago

bwilliams1 commented 4 months ago

I currently support a .NET framework 4.8 ASP.NET Web API solution that has a long term goal of migrating to the future versions of .NET such as .NET 9.0. At this time we use Newtonsoft.Json as part of the request/reply deserialization/serialization of API Controllers as native to ASP.NET. We also decided to use Microsoft.AspNet.WebApi.Client (which also depends on Newtonsoft.Json) for deserialization/serialization of request/reply to external API calls that this application depends on. Both of which we plan to take with us as we migrate to .NET 9.0 and beyond.

With the announcement of Binary Formatter being removed from .NET 9, what can we expect from Newtonsoft.Json when running on .NET 9 and beyond? I took a quick glance at the code and there appears to be many instances of the namespace System.Runtime.Serialization.

We've tried to disable the binary formatter related serialization support as best we can, even though Microsoft.AspNet.WebApi.Client makes it a little more difficult by only allowing us to do this by specifying a list of custom MediaTypeFormatters when using ReadAsAsync and disabling it (IgnoreSerializableAttribute = true) in those formatters. A global setting to disable for all use cases would be ideal. (Perhaps a feature request for that repo, but figured I'd start here)

JamesNK commented 4 months ago

System.Runtime.Serialization and BinaryFormatter are different. Using attributes of APIs from that name space doesn't mean BinaryFormatter is used.

There is no impact on Newtonsoft.Json.