Skip to content

Add OptIn mode for source generator - #1861

Merged
Manodasan Wignarajah (manodasanW) merged 23 commits into
masterfrom
manodasanw/optinMode2
Nov 8, 2024
Merged

Manodasan Wignarajah (manodasanW) merged 23 commits into
masterfrom
manodasanw/optinMode2

Conversation

@manodasanW

@manodasanW Manodasan Wignarajah (manodasanW) commented Nov 4, 2024

Copy link
Copy Markdown
Member

This change adds a couple new modes for the source generator. The source generator can now either run in Auto mode which eventually would be a build task or in OptIn mode. By default, in the default mode of true, in WinUI / UWP scenarios, it would run in Auto mode. Whereas in the other scenarios, it would run in OptIn mode. This allows to address the feedback where it was source generating vtables in scenarios where it is probably not needed. To enable the OptIn mode, the GeneratedWinRTExposedType and the GeneratedWinRTExposedExternalType attributes are added which allows to generate the vtables based on the use of the attributes. These attributes are added only for the .NET 8 and later versions given the upcoming .NET 6 EOL.

Contributes to #1814

@Sergio0694 Sergio Pedri (Sergio0694) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a first pass (haven't tested it yet), but looks good so far! 🙂

Comment thread docs/aot-trimming.md
Comment thread docs/aot-trimming.md
Comment thread docs/aot-trimming.md Outdated
Comment thread src/Authoring/WinRT.SourceGenerator/AotOptimizer.cs
Comment thread src/WinRT.Runtime/Attributes.cs
Comment thread src/WinRT.Runtime/ComWrappersSupport.net5.cs Outdated
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.

2 participants