Skip to content

Add ExcludeStatics API #117905

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 2 commits into from
Jul 23, 2025
Merged

Add ExcludeStatics API #117905

merged 2 commits into from
Jul 23, 2025

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Jul 21, 2025

Together with #117904, fixes #117524.

@sbomer sbomer requested review from a team and Copilot July 21, 2025 23:15
@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 21, 2025
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 adds an ExcludeStatics property to two code analysis attributes (RequiresDynamicCodeAttribute and RequiresUnreferencedCodeAttribute) to provide developers with fine-grained control over whether the attributes should apply to static members of a class.

Key changes:

  • Adds ExcludeStatics boolean property to both attributes with appropriate XML documentation
  • Updates the reference assembly to include the new API surface

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/libraries/System.Runtime/ref/System.Runtime.cs Updates reference assembly to expose new ExcludeStatics property on both attributes
src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/RequiresUnreferencedCodeAttribute.cs Implements ExcludeStatics property with XML documentation
src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/RequiresDynamicCodeAttribute.cs Implements ExcludeStatics property with XML documentation

Doc that true means statics are excluded
@sbomer
Copy link
Member Author

sbomer commented Jul 23, 2025

/ba-g "timeouts"

@sbomer sbomer merged commit 115a89d into dotnet:main Jul 23, 2025
128 of 143 checks passed
@sbomer sbomer deleted the excludeStaticsApi branch July 23, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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]: Add ExcludeStatics to RequiresUnreferencedCode and RequiresDynamicCode
2 participants