From cd3d7b48cb52b07de22d698311c1c8768a6b1953 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 22 Jul 2025 20:54:50 +0000 Subject: [PATCH 1/4] Initial plan From 9c429f59e421cff2993a8dbb6d3336fdcc0db3a3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 22 Jul 2025 21:00:27 +0000 Subject: [PATCH 2/4] Add breaking change documentation for DynamicallyAccessedMembers annotation removal Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- docs/core/compatibility/10.0.md | 1 + ...amically-accessed-members-configuration.md | 39 +++++++++++++++++++ docs/core/compatibility/toc.yml | 2 + 3 files changed, 42 insertions(+) create mode 100644 docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index 067fb31fe6c49..c70491033cd2c 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -41,6 +41,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af | Title | Type of change | Introduced version | |-------|---------------------|--------------------| | [ProviderAliasAttribute moved to Microsoft.Extensions.Logging.Abstractions assembly](extensions/10.0/provideraliasattribute-moved-assembly.md) | Source incompatible | Preview 4 | +| [Removed DynamicallyAccessedMembers annotation from trim-unsafe Microsoft.Extensions.Configuration code](extensions/10.0/dynamically-accessed-members-configuration.md) | Binary incompatible | Preview 6 | ## Globalization diff --git a/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md b/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md new file mode 100644 index 0000000000000..c3924912f14e2 --- /dev/null +++ b/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md @@ -0,0 +1,39 @@ +--- +title: "Breaking change: Removed DynamicallyAccessedMembers annotation from trim-unsafe Microsoft.Extensions.Configuration code" +description: "Learn about the breaking change in .NET 10 where DynamicallyAccessedMembers annotations were removed from trim-unsafe Microsoft.Extensions.Configuration APIs." +ms.date: 12/21/2024 +ai-usage: ai-assisted +ms.custom: https://github.com/dotnet/docs/issues/47433 +--- + +# Removed DynamicallyAccessedMembers annotation from trim-unsafe Microsoft.Extensions.Configuration code + +Certain Microsoft.Extensions.Configuration APIs that were marked as `RequiresUnreferencedCode` and had `DynamicallyAccessedMembers` annotations to preserve some necessary members during trimming have had those annotations removed completely. This change affects the trimming behavior of these APIs in .NET 10. + +## Version introduced + +.NET 10 Preview 6 + +## Previous behavior + +Previously, certain Microsoft.Extensions.Configuration APIs worked with some limited use cases while generating trimming warnings at publish time. These APIs were annotated to preserve at least some of the necessary members when trimming, making the API partially functional in trimmed scenarios. + +## New behavior + +Starting in .NET 10, the same Microsoft.Extensions.Configuration APIs now work with even more limited use cases while still generating trimming warnings at publish time. The `DynamicallyAccessedMembers` annotations have been completely removed, reducing the amount of code preserved during trimming. + +## Type of breaking change + +This change can affect [binary compatibility](../../categories.md#binary-compatibility). + +## Reason for change + +The annotations were removed as part of an effort to remove uses of `DynamicallyAccessedMemberTypes.All` from the product. This change encourages users to migrate to more trim-safe alternatives. + +## Recommended action + +Use the binding configuration source generator, which works reliably with trimming and provides a trim-safe alternative to these APIs. + +## Affected APIs + +Overloads that generate trimming warnings. \ No newline at end of file diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 9b14f0c460bb2..c0ed2a5a0ab4e 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -50,6 +50,8 @@ items: items: - name: "ProviderAliasAttribute moved to Microsoft.Extensions.Logging.Abstractions assembly" href: extensions/10.0/provideraliasattribute-moved-assembly.md + - name: "Removed DynamicallyAccessedMembers annotation from trim-unsafe Microsoft.Extensions.Configuration code" + href: extensions/10.0/dynamically-accessed-members-configuration.md - name: Globalization items: - name: Environment variable renamed to DOTNET_ICU_VERSION_OVERRIDE From 42b1a53880d1d9a0adea7b844d8e1aacd5cec6f7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 22 Jul 2025 21:10:16 +0000 Subject: [PATCH 3/4] Use xref links instead of backticks for API names in breaking change documentation Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../10.0/dynamically-accessed-members-configuration.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md b/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md index c3924912f14e2..3a87afd4729fd 100644 --- a/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md +++ b/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md @@ -8,7 +8,7 @@ ms.custom: https://github.com/dotnet/docs/issues/47433 # Removed DynamicallyAccessedMembers annotation from trim-unsafe Microsoft.Extensions.Configuration code -Certain Microsoft.Extensions.Configuration APIs that were marked as `RequiresUnreferencedCode` and had `DynamicallyAccessedMembers` annotations to preserve some necessary members during trimming have had those annotations removed completely. This change affects the trimming behavior of these APIs in .NET 10. +Certain Microsoft.Extensions.Configuration APIs that were marked as and had annotations to preserve some necessary members during trimming have had those annotations removed completely. This change affects the trimming behavior of these APIs in .NET 10. ## Version introduced @@ -20,7 +20,7 @@ Previously, certain Microsoft.Extensions.Configuration APIs worked with some lim ## New behavior -Starting in .NET 10, the same Microsoft.Extensions.Configuration APIs now work with even more limited use cases while still generating trimming warnings at publish time. The `DynamicallyAccessedMembers` annotations have been completely removed, reducing the amount of code preserved during trimming. +Starting in .NET 10, the same Microsoft.Extensions.Configuration APIs now work with even more limited use cases while still generating trimming warnings at publish time. The annotations have been completely removed, reducing the amount of code preserved during trimming. ## Type of breaking change @@ -28,7 +28,7 @@ This change can affect [binary compatibility](../../categories.md#binary-compati ## Reason for change -The annotations were removed as part of an effort to remove uses of `DynamicallyAccessedMemberTypes.All` from the product. This change encourages users to migrate to more trim-safe alternatives. +The annotations were removed as part of an effort to remove uses of from the product. This change encourages users to migrate to more trim-safe alternatives. ## Recommended action From c8de061334fa18456123995ec659a6cf59f81c99 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 22 Jul 2025 14:50:58 -0700 Subject: [PATCH 4/4] list affected apis --- ...amically-accessed-members-configuration.md | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md b/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md index 3a87afd4729fd..397929aa9a1ed 100644 --- a/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md +++ b/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md @@ -1,14 +1,14 @@ --- -title: "Breaking change: Removed DynamicallyAccessedMembers annotation from trim-unsafe Microsoft.Extensions.Configuration code" +title: "Breaking change: DynamicallyAccessedMembers annotation removed from trim-unsafe configuration APIs" description: "Learn about the breaking change in .NET 10 where DynamicallyAccessedMembers annotations were removed from trim-unsafe Microsoft.Extensions.Configuration APIs." -ms.date: 12/21/2024 +ms.date: 07/22/2025 ai-usage: ai-assisted ms.custom: https://github.com/dotnet/docs/issues/47433 --- -# Removed DynamicallyAccessedMembers annotation from trim-unsafe Microsoft.Extensions.Configuration code +# DynamicallyAccessedMembers annotation removed from trim-unsafe configuration APIs -Certain Microsoft.Extensions.Configuration APIs that were marked as and had annotations to preserve some necessary members during trimming have had those annotations removed completely. This change affects the trimming behavior of these APIs in .NET 10. +[Certain APIs](#affected-apis) related to that were marked as were also annotated to preserve at least some of the necessary members when trimming. This made the API partially work when trimming, while still generating trimming warnings. The annotations are now removed completely. Users are encouraged to migrate to the source generator that works reliably with trimming. ## Version introduced @@ -16,11 +16,11 @@ Certain Microsoft.Extensions.Configuration APIs that were marked as annotations have been completely removed, reducing the amount of code preserved during trimming. +Starting in .NET 10, the [affected APIs](#affected-apis) now work with even more limited use cases while still generating trimming warnings at publish time. ## Type of breaking change @@ -28,7 +28,7 @@ This change can affect [binary compatibility](../../categories.md#binary-compati ## Reason for change -The annotations were removed as part of an effort to remove uses of from the product. This change encourages users to migrate to more trim-safe alternatives. +The annotations were removed as part of an effort to remove uses of from the product. ## Recommended action @@ -36,4 +36,19 @@ Use the binding configuration source generator, which works reliably with trimmi ## Affected APIs -Overloads that generate trimming warnings. \ No newline at end of file +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +-