Skip to content

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
@github-actions github-actions bot locked and limited conversation to collaborators Aug 23, 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]: Add ExcludeStatics to RequiresUnreferencedCode and RequiresDynamicCode
2 participants