Add ExtensionMarkerAttribute#118188
Merged
jeffhandley merged 1 commit intodotnet:mainfrom Aug 8, 2025
Merged
Conversation
This was referenced Jul 24, 2025
This was referenced Jul 30, 2025
a16ff24 to
a914d7d
Compare
a914d7d to
bcef225
Compare
Contributor
There was a problem hiding this comment.
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 |
tannergooding
approved these changes
Aug 7, 2025
Member
|
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. |
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.
Closes #118179
Relates to feature test plan dotnet/roslyn#76130