From 9c9933b928f9df9427b785396808530a15a8ef8d Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 22 Sep 2021 13:55:47 -0700 Subject: [PATCH 1/5] move file to serialization area --- docs/core/compatibility/6.0.md | 2 +- .../6.0/jsonserializer-source-generator-overloads.md | 0 docs/core/compatibility/toc.yml | 12 ++++++++---- 3 files changed, 9 insertions(+), 5 deletions(-) rename docs/core/compatibility/{core-libraries => serialization}/6.0/jsonserializer-source-generator-overloads.md (100%) diff --git a/docs/core/compatibility/6.0.md b/docs/core/compatibility/6.0.md index db40efa5361b5..9e84dd59ff985 100644 --- a/docs/core/compatibility/6.0.md +++ b/docs/core/compatibility/6.0.md @@ -47,7 +47,6 @@ If you're migrating an app to .NET 6, the breaking changes listed here might aff | [FileStream no longer synchronizes file offset with OS](core-libraries/6.0/filestream-doesnt-sync-offset-with-os.md) | Preview 4 | | [FileStream.Position updates after ReadAsync or WriteAsync completes](core-libraries/6.0/filestream-position-updates-after-readasync-writeasync-completion.md) | Preview 4 | | [New diagnostic IDs for obsoleted APIs](core-libraries/6.0/diagnostic-id-change-for-obsoletions.md) | Preview 5 | -| [New JsonSerializer source generator overloads](core-libraries/6.0/jsonserializer-source-generator-overloads.md) | Preview 6 | | [New nullable annotation in AssociatedMetadataTypeTypeDescriptionProvider](core-libraries/6.0/nullable-ref-type-annotations-added.md) | RC 2 | | [New System.Linq.Queryable method overloads](core-libraries/6.0/additional-linq-queryable-method-overloads.md) | Preview 3-4 | | [Older framework versions dropped from package](core-libraries/6.0/older-framework-versions-dropped.md) | Preview 5 | @@ -107,6 +106,7 @@ If you're migrating an app to .NET 6, the breaking changes listed here might aff | Title | Preview introduced | | - | - | | [JsonNode no longer supports C# `dynamic` type](serialization/6.0/jsonnode-dynamic-type.md) | Preview 7 | +| [New JsonSerializer source generator overloads](serialization/6.0/jsonserializer-source-generator-overloads.md) | Preview 6 | ## Windows Forms diff --git a/docs/core/compatibility/core-libraries/6.0/jsonserializer-source-generator-overloads.md b/docs/core/compatibility/serialization/6.0/jsonserializer-source-generator-overloads.md similarity index 100% rename from docs/core/compatibility/core-libraries/6.0/jsonserializer-source-generator-overloads.md rename to docs/core/compatibility/serialization/6.0/jsonserializer-source-generator-overloads.md diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index c114f8b0a4c37..095836eab633b 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -77,8 +77,6 @@ items: href: core-libraries/6.0/filestream-position-updates-after-readasync-writeasync-completion.md - name: New diagnostic IDs for obsoleted APIs href: core-libraries/6.0/diagnostic-id-change-for-obsoletions.md - - name: New JsonSerializer source generator overloads - href: core-libraries/6.0/jsonserializer-source-generator-overloads.md - name: New nullable annotation in AssociatedMetadataTypeTypeDescriptionProvider href: core-libraries/6.0/nullable-ref-type-annotations-added.md - name: New Queryable method overloads @@ -139,6 +137,12 @@ items: href: sdk/6.0/outputtype-not-set-automatically.md - name: RuntimeIdentifier warning if self-contained is unspecified href: sdk/6.0/runtimeidentifier-self-contained.md + - name: Serialization + items: + - name: JsonNode no longer supports C# `dynamic` + href: serialization/6.0/jsonnode-dynamic-type.md + - name: New JsonSerializer source generator overloads + href: serialization/6.0/jsonserializer-source-generator-overloads.md - name: Windows Forms items: - name: APIs throw ArgumentNullException @@ -579,8 +583,6 @@ items: href: core-libraries/6.0/filestream-position-updates-after-readasync-writeasync-completion.md - name: New diagnostic IDs for obsoleted APIs href: core-libraries/6.0/diagnostic-id-change-for-obsoletions.md - - name: New JsonSerializer source generator overloads - href: core-libraries/6.0/jsonserializer-source-generator-overloads.md - name: New nullable annotation in AssociatedMetadataTypeTypeDescriptionProvider href: core-libraries/6.0/nullable-ref-type-annotations-added.md - name: New Queryable method overloads @@ -805,6 +807,8 @@ items: items: - name: JsonNode no longer supports C# `dynamic` href: serialization/6.0/jsonnode-dynamic-type.md + - name: New JsonSerializer source generator overloads + href: serialization/6.0/jsonserializer-source-generator-overloads.md - name: .NET 5 items: - name: BinaryFormatter.Deserialize rewraps exceptions From cfdb3b088b9424dd5e0bd10a49708a9afb5316b4 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 22 Sep 2021 14:45:51 -0700 Subject: [PATCH 2/5] add source gen breaking change --- docs/core/compatibility/6.0.md | 1 + .../6.0/json-source-gen-api-refactor.md | 43 +++++++++++++++++++ docs/core/compatibility/toc.yml | 4 ++ .../system-text-json-source-generation.md | 2 +- 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md diff --git a/docs/core/compatibility/6.0.md b/docs/core/compatibility/6.0.md index 9e84dd59ff985..05577658c910c 100644 --- a/docs/core/compatibility/6.0.md +++ b/docs/core/compatibility/6.0.md @@ -105,6 +105,7 @@ If you're migrating an app to .NET 6, the breaking changes listed here might aff | Title | Preview introduced | | - | - | +| [JSON source-generation API refactoring](serialization/6.0/json-source-gen-api-refactor.md) | RC 2 | | [JsonNode no longer supports C# `dynamic` type](serialization/6.0/jsonnode-dynamic-type.md) | Preview 7 | | [New JsonSerializer source generator overloads](serialization/6.0/jsonserializer-source-generator-overloads.md) | Preview 6 | diff --git a/docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md b/docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md new file mode 100644 index 0000000000000..6d4cad25579c6 --- /dev/null +++ b/docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md @@ -0,0 +1,43 @@ +--- +title: "Breaking change: JSON source-generation API refactoring" +description: Learn about the .NET 6.0 breaking change where the APIs called by JSON source generator output were refactored. +ms.date: 09/22/2021 +--- +# JSON source-generation API refactoring + +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. Projects that explicitly use the JSON source generator and were compiled with .NET 6 RC 1 or earlier will fail with run-time exceptions when run on the .NET 6 RC 2 runtime. + +## Previous behavior + +Projects that were compiled using the .NET 6 RC 1 or earlier version of the STJ source generator and library run as expected. + +## New behavior + +Projects that were compiled using the .NET 6 RC 1 version of the STJ source generator and library fail when run against the .NET 6 RC 2 runtime. Projects that are recompiled with the RC 2 SDK work as expected. + +## Version introduced + +6.0 RC 2 + +## Type of breaking change + +This change can affect [binary compatibility](../../categories.md#binary-compatibility). + +## Reason for change + +This change was introduced to make it easier to extend the source-generator implementation with features in the future. For more information, see [dotnet/runtime#59243](https://github.com/dotnet/runtime/pull/59243). + +## Recommended action + +Recompile your app using the RC 2 SDK. + +## Affected APIs + +- +- +- +- (not intended for direct use) + +## See also + +- [How to use source generation in System.Text.Json](../../../../standard/serialization/system-text-json-source-generation.md) diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 095836eab633b..40fa24eadcf79 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -139,6 +139,8 @@ items: href: sdk/6.0/runtimeidentifier-self-contained.md - name: Serialization items: + - name: JSON source-generation API refactoring + href: serialization/6.0/json-source-gen-api-refactor.md - name: JsonNode no longer supports C# `dynamic` href: serialization/6.0/jsonnode-dynamic-type.md - name: New JsonSerializer source generator overloads @@ -805,6 +807,8 @@ items: items: - name: .NET 6 items: + - name: JSON source-generation API refactoring + href: serialization/6.0/json-source-gen-api-refactor.md - name: JsonNode no longer supports C# `dynamic` href: serialization/6.0/jsonnode-dynamic-type.md - name: New JsonSerializer source generator overloads diff --git a/docs/standard/serialization/system-text-json-source-generation.md b/docs/standard/serialization/system-text-json-source-generation.md index e78f87a062637..c7560d1229453 100644 --- a/docs/standard/serialization/system-text-json-source-generation.md +++ b/docs/standard/serialization/system-text-json-source-generation.md @@ -68,7 +68,7 @@ The following table shows which options specified by `JsonSerializerOptions` are | | ❌ | | \* | ✔️ | -\* Some `Serialize` methods let you pass in a `Utf8JsonWriter` instance. In that case, you can set the `Encoder` and `WriteIndented` options by using and . +\* Some `Serialize` methods let you pass in a `Utf8JsonWriter` instance. In that case, you can set the `Encoder` and `WriteIndented` options by using and . The following table shows which attributes are supported by the optimized serialization code: From 0b30838c2f7f6190e01ca0163cdd34508bd2f0ab Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 22 Sep 2021 14:51:02 -0700 Subject: [PATCH 3/5] add redirect --- .openpublishing.redirection.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.openpublishing.redirection.json b/.openpublishing.redirection.json index 40b7278557911..fd4bb04f95119 100644 --- a/.openpublishing.redirection.json +++ b/.openpublishing.redirection.json @@ -250,6 +250,11 @@ "source_path": "docs/core/compatibility/code-analysis.md", "redirect_url": "/dotnet/core/compatibility/code-analysis/5.0/ca1416-platform-compatibility-analyzer" }, + { + "source_path": "docs/core/compatibility/core-libraries/6.0/jsonserializer-source-generator-overloads.md", + "redirect_url": "/dotnet/core/compatibility/serialization/6.0/jsonserializer-source-generator-overloads", + "redirect_document_id": true + }, { "source_path": "docs/core/compatibility/interop.md", "redirect_url": "/dotnet/core/compatibility/interop/5.0/built-in-support-for-winrt-removed" From 745d2b1cbdd93a88c15a199bc3b5ac97bddd22d4 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 22 Sep 2021 14:52:55 -0700 Subject: [PATCH 4/5] tweaks --- .../serialization/6.0/json-source-gen-api-refactor.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md b/docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md index 6d4cad25579c6..06cf3b0f786c2 100644 --- a/docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md +++ b/docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md @@ -5,11 +5,11 @@ ms.date: 09/22/2021 --- # JSON source-generation API refactoring -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. Projects that explicitly use the JSON source generator and were compiled with .NET 6 RC 1 or earlier will fail with run-time exceptions when run on the .NET 6 RC 2 runtime. +The APIs that the output of the JSON source generator calls have been refactored. The refactoring makes them easier to extend with new features in the future. Projects that explicitly use the JSON source generator and were compiled with .NET 6 RC 1 or earlier will fail with run-time exceptions when run on the .NET 6 RC 2 runtime. ## Previous behavior -Projects that were compiled using the .NET 6 RC 1 or earlier version of the STJ source generator and library run as expected. +Projects that were compiled using the .NET 6 RC 1 or earlier version of the System.Text.Jason (STJ) source generator and library run as expected. ## New behavior From f105d688dd4efd9089ce20e50b97fa9bbfc34912 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 22 Sep 2021 20:28:11 -0700 Subject: [PATCH 5/5] fix typo --- .../serialization/6.0/json-source-gen-api-refactor.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md b/docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md index 06cf3b0f786c2..416bb46284f04 100644 --- a/docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md +++ b/docs/core/compatibility/serialization/6.0/json-source-gen-api-refactor.md @@ -9,11 +9,11 @@ The APIs that the output of the JSON source generator calls have been refactored ## Previous behavior -Projects that were compiled using the .NET 6 RC 1 or earlier version of the System.Text.Jason (STJ) source generator and library run as expected. +Projects that were compiled using the .NET 6 RC 1 or earlier version of the System.Text.Json source generator and library run as expected. ## New behavior -Projects that were compiled using the .NET 6 RC 1 version of the STJ source generator and library fail when run against the .NET 6 RC 2 runtime. Projects that are recompiled with the RC 2 SDK work as expected. +Projects that were compiled using the .NET 6 RC 1 version of the System.Text.Json source generator and library fail when run against the .NET 6 RC 2 runtime. Projects that are recompiled with the RC 2 SDK work as expected. ## Version introduced