-
Notifications
You must be signed in to change notification settings - Fork 122
Add attributes for authoring support #2230
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
Conversation
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
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.
src/WinRT.Runtime2/InteropServices/Attributes/WindowsRuntimeAuthoringAssemblyAttribute.cs
Outdated
Show resolved
Hide resolved
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).
0bb7620 to
69fedc1
Compare
Rename WindowsRuntimeAuthoringAssemblyAttribute to WindowsRuntimeComponentAssemblyAttribute: file renamed and class, constructor, and XML doc updated to reflect the new name. No behavioral changes; this aligns the API/type name with component assembly semantics.
Title.