-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Drop usage of .All on DefaultValueAttribute
#117708
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
Conversation
This functionality of `DefaultValueAttribute` constructor is disabled by default and warns if it gets enabled. We shouldn't need to keep things on the type passed to the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes the DynamicallyAccessedMemberTypes.All annotation from the DefaultValueAttribute constructor that takes a Type and string parameter. The change is motivated by the fact that this functionality is disabled by default and generates warnings when enabled, making the broad type access requirement unnecessary.
Key changes:
- Removed
DynamicallyAccessedMembersAttributeannotation from the constructor parameter - Added API compatibility suppressions for the breaking change
- Added IL linker warning suppressions to maintain existing developer experience
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/libraries/System.Private.CoreLib/src/System/ComponentModel/DefaultValueAttribute.cs |
Removed DynamicallyAccessedMembersAttribute from Type parameter |
src/libraries/System.Runtime/ref/System.Runtime.cs |
Updated reference assembly to match implementation |
src/libraries/apicompat/ApiCompatBaseline.NetCoreAppLatestStable.xml |
Added suppressions for API compatibility breaking changes |
src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Suppressions.LibraryBuild.xml |
Added IL2067 suppression for the constructor |
|
/ba-g helix deadletter |
|
@eerhardt do you think we'd need to mark this one as a breaking change too? it's not clear to me how much this actually worked with the feature switch set to the untrimmable value. presumably one got a hard-to-suppress warning in corelib to begin with. |
|
This one doesn't feel critical. But if we are marking a breaking change for others, it feels like we should be consistent. |
This functionality of
DefaultValueAttributeconstructor is disabled by default and warns if it gets enabled. We shouldn't need to keep things on the type passed to the constructor.Cc @eerhardt - as you suggested on Teams