Skip to content

Document DefaultValueAttribute constructor DynamicallyAccessedMembers removal breaking change for .NET 10 #47921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 12, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 11, 2025

This PR documents a breaking change in .NET 10 where the DefaultValueAttribute(System.Type type, string? value) constructor is no longer annotated with DynamicallyAccessedMembersAttribute.

Changes Made

  • Created new breaking change documentation file: defaultvalueattribute-dynamically-accessed-members.md
  • Added entry to the Core .NET libraries section in the main .NET 10 breaking changes index

Background

The DefaultValueAttribute(System.Type type, string? value) constructor is not supported with trimming and will throw an exception if reached at runtime in a trimmed app. While it was previously possible to disable the exception throwing mechanism with a feature switch, the removal of the DynamicallyAccessedMembers annotation means fewer cases will work reliably.

This is both a binary incompatible and source incompatible breaking change that affects applications using this constructor in trimmed scenarios.

Documentation Details

The documentation follows the established format for breaking changes and includes:

  • Clear description of the change and its impact
  • Previous vs. new behavior comparison
  • Type of breaking change classification
  • Reason for the change
  • Recommended action for developers
  • Affected API reference

Fixes #47444.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Internal previews

📄 File 🔗 Preview link
docs/core/compatibility/10.0.md Breaking changes in .NET 10
docs/core/compatibility/core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md DynamicallyAccessedMembers annotation removed from DefaultValueAttribute ctor
docs/core/compatibility/toc.yml docs/core/compatibility/toc

@Copilot Copilot AI changed the title [WIP] [Breaking change]: DefaultValueAttribute(System.Type type, string? value) constructor no longer annotated with DynamicallyAccessedMembers Document DefaultValueAttribute constructor DynamicallyAccessedMembers removal breaking change for .NET 10 Aug 11, 2025
Copilot finished work on behalf of gewarren August 11, 2025 22:35
@Copilot Copilot AI requested a review from gewarren August 11, 2025 22:35
@gewarren gewarren marked this pull request as ready for review August 12, 2025 01:53
@gewarren gewarren requested a review from a team as a code owner August 12, 2025 01:53
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM as well.

@BillWagner BillWagner merged commit a68703f into main Aug 12, 2025
10 checks passed
@BillWagner BillWagner deleted the copilot/fix-47444 branch August 12, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Breaking change]: DefaultValueAttribute(System.Type type, string? value) constructor no longer annotated with DynamicallyAccessedMembers
4 participants