Summary
The .NET SDK currently ships the Newtonsoft.Json assembly in several locations within the SDK layout. We should remove this dependency from the SDK by eliminating project references that bring it in and migrating usages to System.Text.Json where possible.
Removing this dependency would reduce the SDK servicing surface area, decrease SDK size, and unblock work related to Native AOT.
Motivation
Security / Servicing
Bundling Newtonsoft.Json in the SDK introduces an additional dependency that must be monitored and serviced for potential security vulnerabilities.
Migrating to System.Text.Json reduces this servicing burden because it ships as part of the .NET platform and is already covered by the platform servicing model.
SDK Size Reduction
Removing Newtonsoft.Json would also help reduce the size of the SDK installation.
Historically the SDK contained multiple copies of this assembly. Deduplication work reduced this to two primary copies, but it still contributes unnecessary size to the SDK.
Related work:
Native AOT Compatibility
Usage of Newtonsoft.Json is a blocker for some Native AOT scenarios due to its heavy reliance on reflection and dynamic behavior. Migrating to System.Text.Json helps unblock this work.
Related work:
Current Locations in the SDK
The following instances of Newtonsoft.Json.dll currently appear in the SDK layout:
Migration Guideline
https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/migrate-from-newtonsoft?pivots=dotnet-10-0
Summary
The .NET SDK currently ships the
Newtonsoft.Jsonassembly in several locations within the SDK layout. We should remove this dependency from the SDK by eliminating project references that bring it in and migrating usages toSystem.Text.Jsonwhere possible.Removing this dependency would reduce the SDK servicing surface area, decrease SDK size, and unblock work related to Native AOT.
Motivation
Security / Servicing
Bundling
Newtonsoft.Jsonin the SDK introduces an additional dependency that must be monitored and serviced for potential security vulnerabilities.Migrating to
System.Text.Jsonreduces this servicing burden because it ships as part of the .NET platform and is already covered by the platform servicing model.SDK Size Reduction
Removing
Newtonsoft.Jsonwould also help reduce the size of the SDK installation.Historically the SDK contained multiple copies of this assembly. Deduplication work reduced this to two primary copies, but it still contributes unnecessary size to the SDK.
Related work:
Native AOT Compatibility
Usage of
Newtonsoft.Jsonis a blocker for some Native AOT scenarios due to its heavy reliance on reflection and dynamic behavior. Migrating toSystem.Text.Jsonhelps unblock this work.Related work:
Current Locations in the SDK
The following instances of
Newtonsoft.Json.dllcurrently appear in the SDK layout:Migration Guideline
https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/migrate-from-newtonsoft?pivots=dotnet-10-0