Open Gaoyifei1011 opened 1 week ago
You're likely using WinUI 3 without enabling <PublishAot>
, which causes different behavior due to IsDynamicCodeCompiled
returning false
, not due to UWP and WinUI 3 differences. Chances are if you enable that property on WinUI 3 as well you would also see that exception.
Add <DynamicCodeSupport>true</DynamicCodeSupport>
to your UWP .csproj. Only works without AOT.
You're likely using WinUI 3 without enabling
<PublishAot>
, which causes different behavior due toIsDynamicCodeCompiled
returningfalse
, not due to UWP and WinUI 3 differences. Chances are if you enable that property on WinUI 3 as well you would also see that exception.
Nowhere. When I turned on aot in the winui3 project, it did throw the same exceptions as the uwp project. So do you have a solution for non-dynamic code? Thank you very much
确实。当我在winui3项目中开启了aot后发现它确实抛出了和uwp项目一样的异常。所以想问一下您有针对非动态代码的解决方案吗?非常感谢
Nope, it's just unsupported.
Nope, it's just unsupported.
All right. I can now do this only by temporarily replacing the generic TypedEventHandler with a non-generic EventHandler.
好吧。我现在只能用非泛型的 EventHandler 临时替代泛型的 TypedEventHandler 来完成这一任务了。
Description
MarshalInspectable.CreateMarshaler exhibits different behaviors and results in UWP and WinUI 3
------------------------------------------
MarshalInspectable.CreateMarshaler 在 UWP 和 WinUI 3 中表现出不同的行为和结果
Steps To Reproduce
------------------------------------------
1.创建 WinUI 3 和 UWP 空白项目,项目使用的配置: .NET 9 rc 2,CsWinRT 2.1.6,Windows App SDK 1.6.240923002 2.应用初始化完成后,添加如下代码
3.在 UWP 中发生了异常,WinUI 3 项目顺利执行。
Expected Behavior
The above types of code will hopefully be called smoothly in UWP as well
------------------------------------------
上述类型代码希望也可以在 UWP 中顺利调用
Version Info
CsWinRT 2.1.6 .NET 9 RC2 Windows App SDK 1.6.240923002 Visual Studio 2022 17.12.preview 4.0
Additional Context
ScreenShot(截图)
------------------------------------------
UWP
------------------------------------------
WinUI 3