Skip to content

Conversation

MichalStrehovsky
Copy link
Member

Resolves #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.

Cc @dotnet/appmodel

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.
@Copilot Copilot AI review requested due to automatic review settings July 16, 2025 12:47
Copy link
Contributor

@Copilot Copilot AI left a 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 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)] to All in 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 All enum member is decorated with EditorBrowsable(EditorBrowsableState.Never). This will catch regressions if the attribute is ever removed or modified.
        [EditorBrowsable(EditorBrowsableState.Never)]

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 16, 2025
@MichalStrehovsky
Copy link
Member Author

/ba-g helix deadletter

@MichalStrehovsky MichalStrehovsky merged commit d342697 into dotnet:main Jul 16, 2025
134 of 145 checks passed
@MichalStrehovsky MichalStrehovsky deleted the damtall branch July 16, 2025 21:22
@github-actions github-actions bot locked and limited conversation to collaborators Aug 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API Proposal]: Mark DynamicallyAccessedMemberTypes.All as EditorBrowsable(Never)

2 participants