Add attributes for authoring support#2230
Open
Sergio0694 wants to merge 3 commits intostaging/3.0from
Open
Conversation
Introduce WindowsRuntimeAuthoringAssemblyAttribute as a marker for assemblies that author Windows Runtime components (produce .winmd). The new sealed attribute (in WindowsRuntime.InteropServices) is marked [AttributeUsage(Assembly)], [EditorBrowsable(Never)] and [Obsolete] with CsWinRT diagnostic constants; it is intended to be emitted by the CsWinRT generator and not used directly. Includes an empty public constructor.
Introduce WindowsRuntimeExclusiveToInterfaceAttribute to annotate interfaces with their projected Windows Runtime class type. The sealed attribute targets interfaces, exposes a RuntimeClassType property set via constructor, and is marked Obsolete and EditorBrowsable(Never) to indicate it's for private implementation details and should not be used directly.
Rename the constructor parameter in WindowsRuntimeExclusiveToInterfaceAttribute from "interfaceType" to "runtimeClassType" and update the assignment to clarify that it represents the projected Windows Runtime class type. Add a new WindowsRuntimeActivationFactoryAttribute (src/WinRT.Runtime2/InteropServices/Attributes/WindowsRuntimeActivationFactoryAttribute.cs) to annotate the authored Windows Runtime class type for activation factories; the attribute is marked Obsolete (private implementation detail diagnostics) and EditorBrowsable(Never).
There was a problem hiding this comment.
Pull request overview
Adds new internal/implementation-detail attributes to support authored Windows Runtime component scenarios in WinRT.Runtime2, primarily for consumption by generated code (CsWinRT) and authoring/activation metadata.
Changes:
- Added
WindowsRuntimeAuthoringAssemblyAttributeto mark authored WinRT component assemblies that produce their own.winmd. - Added
WindowsRuntimeActivationFactoryAttributeto associate activation factory types with their authored runtime class types. - Added
WindowsRuntimeExclusiveToInterfaceAttributeto mark interfaces as exclusive to a projected runtime class type.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/WinRT.Runtime2/InteropServices/Attributes/WindowsRuntimeAuthoringAssemblyAttribute.cs |
New assembly-level attribute for authored WinRT components producing their own metadata. |
src/WinRT.Runtime2/InteropServices/Attributes/WindowsRuntimeActivationFactoryAttribute.cs |
New class-level attribute to link an activation factory to its runtime class type. |
src/WinRT.Runtime2/Attributes/WindowsRuntimeExclusiveToInterfaceAttribute.cs |
New interface-level attribute to indicate interface exclusivity to a projected runtime class type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Title.