Orignal codes are copied from CsWinRT
Modifed the Generator.SourceGenerator and related code to implements IIncrementalGenerator.
Use RegisterImplementationSourceOutput to avoid unnecessary generation attempt.
- Download the
WinRT.SourceGenerator.dllfrom release or clone this repo and build yourself. - Find the Microsoft.Windows.CsWinRT nuget package local cache and the correct version.
- Find
analyzers/dotnet/cs/WinRT.SourceGenerator.dll - Replace the file and restart Visual Studio.
Now you should see your CPU calm down again.
Not fully tested and should use the official build once Microsoft implement this.