-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add ExtensionMarkerAttribute #118188
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
Add ExtensionMarkerAttribute #118188
Conversation
a16ff24 to
a914d7d
Compare
a914d7d to
bcef225
Compare
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 adds a new ExtensionMarkerAttribute class to support a language feature for associating extension members with specific marker types. The attribute is designed for compiler use and includes appropriate metadata to discourage direct developer usage.
Key Changes
- Adds new
ExtensionMarkerAttributeclass with aNameproperty for marker type association - Includes comprehensive attribute metadata (
EditorBrowsable,AttributeUsage) to control visibility and usage - Provides complete implementation with API surface, tests, and project configuration
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/Runtime/CompilerServices/ExtensionMarkerAttribute.cs |
New attribute implementation with constructor, Name property, and XML documentation |
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems |
Adds the new file to the build configuration |
src/libraries/System.Runtime/ref/System.Runtime.cs |
Adds the public API surface definition for the new attribute |
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/CompilerServices/AttributesTests.cs |
Adds unit tests to verify constructor and Name property functionality |
|
CC. @jeffhandley for M1 approval. This is just the attribute used by Roslyn for the extension member feature so it can avoid synthesizing it into every assembly. |
jeffhandley
left a comment
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.
Approved for RC1
Closes #118179
Relates to feature test plan dotnet/roslyn#76130