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..397929aa9a1ed --- /dev/null +++ b/docs/core/compatibility/extensions/10.0/dynamically-accessed-members-configuration.md @@ -0,0 +1,54 @@ +--- +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: 07/22/2025 +ai-usage: ai-assisted +ms.custom: https://github.com/dotnet/docs/issues/47433 +--- + +# DynamicallyAccessedMembers annotation removed from trim-unsafe configuration APIs + +[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 + +.NET 10 Preview 6 + +## Previous behavior + +Previously, the [affected APIs](#affected-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 [affected APIs](#affected-apis) now work with even more limited use cases while still generating trimming warnings at publish time. + +## 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 from the product. + +## Recommended action + +Use the binding configuration source generator, which works reliably with trimming and provides a trim-safe alternative to these APIs. + +## Affected APIs + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- 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