Skip to content

Add WinRTRuntimeClassName attribute for use in scenarios where we previously used interface name#1573

Merged
manodasanW merged 10 commits intostaging/AOTfrom
manodasanw/generated-runtime-class-name
Apr 19, 2024
Merged

Add WinRTRuntimeClassName attribute for use in scenarios where we previously used interface name#1573
manodasanW merged 10 commits intostaging/AOTfrom
manodasanw/generated-runtime-class-name

Conversation

@manodasanW
Copy link
Member

In scenarios where we have a type that isn't a WinRT type, but implements WinRT interfaces, we previously went through the interfaces and determined the most derived one to return as the runtime class name. This is not trim friendly. With these changes, we will do this in the AOT source generator rather than at runtime and instead at runtime lookup the attribute on the type. This also allows the opportunity for someone in this scenario to specify their own class name if desired as today if there are multiple interfaces that don't inherit from each other, we will need to choose one and that might not be what is desired by the author.

In addition to the scenarios where we put the attribute on the type, there are a couple scenarios where the type isn't authored in the component but rather a system type. To handle these scenarios, we use the lookup table similar to what we do in the CCW vtable scenario.

@manodasanW manodasanW requested a review from Sergio0694 April 17, 2024 15:15
@manodasanW manodasanW merged commit decf319 into staging/AOT Apr 19, 2024
@manodasanW manodasanW deleted the manodasanw/generated-runtime-class-name branch April 19, 2024 05:11
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.

3 participants