Skip to content

[Breaking change]: Removed DynamicallyAccessedMembers annotation from trim-unsafe Microsoft.Extensions.Configuration code #47433

@MichalStrehovsky

Description

@MichalStrehovsky

Description

There were certain APIs related to Microsoft.Extensions.Configuration that were marked as RequiresUnreferencedCode that at the same time were 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.

dotnet/runtime#117707

Version

.NET 10 Preview 6

Previous behavior

Certain Microsoft.Extensions.Configuration APIs worked with some limited use cases while generating trimming warnings at publish time.

New behavior

Certain Microsoft.Extensions.Configuration APIs worked with even more limited use cases while generating trimming warnings at publish time.

Type of breaking change

  • Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
  • Behavioral change: Existing binaries might behave differently at run time.

Reason for change

We're removing uses of DynamicallyAccessedMemberTypes.All from the product.

Recommended action

Use the binding configuration source generator.

Feature area

Extensions

Affected APIs

Overloads that generate trimming warnings.


Associated WorkItem - 454940

Metadata

Metadata

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions