Mark DynamicallyAccessedMemberTypes.All as EditorBrosable(Never)#117720
Merged
MichalStrehovsky merged 1 commit intodotnet:mainfrom Jul 16, 2025
Merged
Mark DynamicallyAccessedMemberTypes.All as EditorBrosable(Never)#117720MichalStrehovsky merged 1 commit intodotnet:mainfrom
DynamicallyAccessedMemberTypes.All as EditorBrosable(Never)#117720MichalStrehovsky merged 1 commit intodotnet:mainfrom
Conversation
Resolves dotnet#114197. `DynamicallyAccessedMemberTypes.All` should be the least used member of this enum, but it is the most popular on all of GitHub. Use of it leads to spurious trimming warnings (because it makes it appear more things are reflected on than needed) and also too much extra size left on the table (for the same reason). Make it harder to discover.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR hides the DynamicallyAccessedMemberTypes.All enum member from IntelliSense to discourage its use, reducing accidental over-broad trimming behavior and unnecessary preserved size.
- Apply
[EditorBrowsable(EditorBrowsableState.Never)]toAllin the reference assembly. - Mirror the attribute in the CoreLib implementation and add the necessary
using.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/libraries/System.Runtime/ref/System.Runtime.cs | Added [EditorBrowsable(EditorBrowsableState.Never)] to the All enum member in the public API surface. |
| src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/DynamicallyAccessedMemberTypes.cs | Introduced using System.ComponentModel; and applied the EditorBrowsable attribute to the All member. |
Comments suppressed due to low confidence (1)
src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/DynamicallyAccessedMemberTypes.cs:170
- Add a unit test in the System.Diagnostics.CodeAnalysis test suite to verify that the
Allenum member is decorated withEditorBrowsable(EditorBrowsableState.Never). This will catch regressions if the attribute is ever removed or modified.
[EditorBrowsable(EditorBrowsableState.Never)]
jkoritzinsky
approved these changes
Jul 16, 2025
This was referenced Jul 16, 2025
Open
Member
Author
|
/ba-g helix deadletter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #114197.
DynamicallyAccessedMemberTypes.Allshould be the least used member of this enum, but it is the most popular on all of GitHub. Use of it leads to spurious trimming warnings (because it makes it appear more things are reflected on than needed) and also too much extra size left on the table (for the same reason). Make it harder to discover.Cc @dotnet/appmodel