Skip to content

Commit c8de061

Browse files
committed
list affected apis
1 parent 42b1a53 commit c8de061

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed
Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,54 @@
11
---
2-
title: "Breaking change: Removed DynamicallyAccessedMembers annotation from trim-unsafe Microsoft.Extensions.Configuration code"
2+
title: "Breaking change: DynamicallyAccessedMembers annotation removed from trim-unsafe configuration APIs"
33
description: "Learn about the breaking change in .NET 10 where DynamicallyAccessedMembers annotations were removed from trim-unsafe Microsoft.Extensions.Configuration APIs."
4-
ms.date: 12/21/2024
4+
ms.date: 07/22/2025
55
ai-usage: ai-assisted
66
ms.custom: https://github.com/dotnet/docs/issues/47433
77
---
88

9-
# Removed DynamicallyAccessedMembers annotation from trim-unsafe Microsoft.Extensions.Configuration code
9+
# DynamicallyAccessedMembers annotation removed from trim-unsafe configuration APIs
1010

11-
Certain Microsoft.Extensions.Configuration APIs that were marked as <xref:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute> and had <xref:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute> 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.
11+
[Certain APIs](#affected-apis) related to <xref:Microsoft.Extensions.Configuration> that were marked as <xref:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute> 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.
1212

1313
## Version introduced
1414

1515
.NET 10 Preview 6
1616

1717
## Previous behavior
1818

19-
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.
19+
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.
2020

2121
## New behavior
2222

23-
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 <xref:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute> annotations have been completely removed, reducing the amount of code preserved during trimming.
23+
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.
2424

2525
## Type of breaking change
2626

2727
This change can affect [binary compatibility](../../categories.md#binary-compatibility).
2828

2929
## Reason for change
3030

31-
The annotations were removed as part of an effort to remove uses of <xref:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All> from the product. This change encourages users to migrate to more trim-safe alternatives.
31+
The annotations were removed as part of an effort to remove uses of <xref:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All?displayProperty=nameWithType> from the product.
3232

3333
## Recommended action
3434

3535
Use the binding configuration source generator, which works reliably with trimming and provides a trim-safe alternative to these APIs.
3636

3737
## Affected APIs
3838

39-
Overloads that generate trimming warnings.
39+
- <xref:Microsoft.Extensions.Configuration.ConfigurationBinder.Get(Microsoft.Extensions.Configuration.IConfiguration,System.Type,System.Action{Microsoft.Extensions.Configuration.BinderOptions})?displayProperty=fullName>
40+
- <xref:Microsoft.Extensions.Configuration.ConfigurationBinder.GetValue(Microsoft.Extensions.Configuration.IConfiguration,System.Type,System.String)?displayProperty=fullName>
41+
- <xref:Microsoft.Extensions.Configuration.ConfigurationBinder.GetValue(Microsoft.Extensions.Configuration.IConfiguration,System.Type,System.String,System.Object)?displayProperty=fullName>
42+
- <xref:Microsoft.Extensions.Configuration.ConfigurationBinder.GetValue``1(Microsoft.Extensions.Configuration.IConfiguration,System.String)?displayProperty=fullName>
43+
- <xref:Microsoft.Extensions.Configuration.ConfigurationBinder.GetValue``1(Microsoft.Extensions.Configuration.IConfiguration,System.String,``0)?displayProperty=fullName>
44+
- <xref:Microsoft.Extensions.Configuration.ConfigurationBinder.Get``1(Microsoft.Extensions.Configuration.IConfiguration)?displayProperty=fullName>
45+
- <xref:Microsoft.Extensions.Configuration.ConfigurationBinder.Get``1(Microsoft.Extensions.Configuration.IConfiguration,System.Action{Microsoft.Extensions.Configuration.BinderOptions})?displayProperty=fullName>
46+
- <xref:Microsoft.Extensions.Logging.Configuration.LoggerProviderOptions.RegisterProviderOptions``2(Microsoft.Extensions.DependencyInjection.IServiceCollection)?displayProperty=fullName>
47+
- <xref:Microsoft.Extensions.Logging.ConsoleLoggerExtensions.AddConsoleFormatter``2(Microsoft.Extensions.Logging.ILoggingBuilder)?displayProperty=fullName>
48+
- <xref:Microsoft.Extensions.Logging.ConsoleLoggerExtensions.AddConsoleFormatter``2(Microsoft.Extensions.Logging.ILoggingBuilder,System.Action{``1})?displayProperty=fullName>
49+
- <xref:Microsoft.Extensions.DependencyInjection.OptionsBuilderConfigurationExtensions.BindConfiguration``1(Microsoft.Extensions.Options.OptionsBuilder{``0},System.String,System.Action{Microsoft.Extensions.Configuration.BinderOptions})?displayProperty=fullName>
50+
- <xref:Microsoft.Extensions.DependencyInjection.OptionsBuilderConfigurationExtensions.Bind``1(Microsoft.Extensions.Options.OptionsBuilder{``0},Microsoft.Extensions.Configuration.IConfiguration)?displayProperty=fullName>
51+
- <xref:Microsoft.Extensions.DependencyInjection.OptionsBuilderConfigurationExtensions.Bind``1(Microsoft.Extensions.Options.OptionsBuilder{``0},Microsoft.Extensions.Configuration.IConfiguration,System.Action{Microsoft.Extensions.Configuration.BinderOptions})?displayProperty=fullName>
52+
- <xref:Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure*?displayProperty=fullName>
53+
- <xref:Microsoft.Extensions.Options.ConfigureFromConfigurationOptions`1?displayProperty=fullName>
54+
- <xref:Microsoft.Extensions.Options.NamedConfigureFromConfigurationOptions`1?displayProperty=fullName>

0 commit comments

Comments
 (0)