-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Description
In dotnet/runtime#59243, we updated the APIs that the output of the JSON source generator calls to make them easier to extend with new features in the future. This will result in projects that explicitly use the JSON source generator and were compiled with .NET RC 1 or earlier to fail with runtime exceptions when run on the .NET RC 2 runtime.
Version
.NET 6 RC2
Previous behavior
Projects that were compiled using the RC1 version of the STJ source generator & library run as expected.
New behavior
Projects that were compiled using the RC1 version of the STJ source generator & library fail when run against the RC 2 runtime. Projects that are recompiled with the RC 2 SDK work as expected.
Type of breaking change
- Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
- Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.
Reason for change
To make the source-generator implementation easier to extend with features in the future. More background here: dotnet/runtime#59243 (comment).
Recommended action
Recompile your applications using the RC 2 SDK.
Feature area
Core .NET libraries
Affected APIs
Usage of
- System.Text.Json.Serialization.JsonSerializerContext, System.Text.Json.Serialization.JsonSerializableAttribute, System.Text.Json.Serialization.JsonSourceGenerationOptions as shown in doc samples: https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-source-generation?pivots=dotnet-6-0
- https://docs.microsoft.com/en-us/dotnet/api/system.text.json.serialization.metadata?view=net-6.0 (not intended for direct usage by customers)