You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When publishing AOT, C#/WinRT throws System.NotSupportedException: 'Cannot retrieve a helper type for generic public type 'Windows.Foundation.IAsyncOperation`1[System.Boolean]'.'
#1871
Open
smourier opened this issue
Nov 15, 2024
· 4 comments
However, I don't think a more general solution to CsWinRT's existing usage pattern (casting from WinRT.IInspectable to a generic WinRT interface using IDynamicInterfaceCastable) would be possible without new projections).
Description
I'm developing a WinUI3 application. When not publishing AOT, it works, but when adding
<PublishAot>true</PublishAot>,
it throwsFull stack trace:
Steps To Reproduce
To reproduce just create a WinUI3 blank project with latest Visual Studio 17.12.0, and modify the
MainWindow.xaml.cs
like this:With standard settings, just run and it will fail on ShowPrintUIForWindowAsync with a COM exception but that's expected.
Now change the project settings to add
PublishAot
, and Rebuild (you must rebuild, a simple build is usually not enough here), here is mine:I've tried .NET 8 and 9, I've also tested with an explicit latest C#/WinRT and
WindowsSdkPackageVersion
references but it's the same.Expected Behavior
It should not fail with a
System.NotSupportedException.
Version Info
Visual Studio 17.12.0
C#/WinRT 2.2.0
.NET 9.0.0 or .NET 8.0.11
Additional Context
I don't know of any workaround, but it would be welcome.
The text was updated successfully, but these errors were encountered: