Skip to content

Add attributes for authoring support#2230

Open
Sergio0694 wants to merge 3 commits intostaging/3.0from
user/sergiopedri/attributes
Open

Add attributes for authoring support#2230
Sergio0694 wants to merge 3 commits intostaging/3.0from
user/sergiopedri/attributes

Conversation

@Sergio0694
Copy link
Member

Title.

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).
Copy link

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

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 WindowsRuntimeAuthoringAssemblyAttribute to mark authored WinRT component assemblies that produce their own .winmd.
  • Added WindowsRuntimeActivationFactoryAttribute to associate activation factory types with their authored runtime class types.
  • Added WindowsRuntimeExclusiveToInterfaceAttribute to 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant