microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.3k stars 676 forks source link

Winui3 islands is not compatible with AppWindow.Titlebar.ExtendsContentIntoTitleBar #9077

Open Gaoyifei1011 opened 10 months ago

Gaoyifei1011 commented 10 months ago

Describe the bug

I tried to modernize the Winform interface with Winui3's DesktopWindowXamlSource in Winform. Get the AppWindow object of the Winform window handle after showing the DesktopWindowXamlSource and try to use WASDK's custom title bar for the window, try to resize the window when done, the application is abnormal and no more prompts.

我尝试在Winform中使用Winui3的DesktopWindowXamlSource来对Winform界面进行现代化改造。在显示DesktopWindowXamlSource后获取Winform窗口句柄的AppWindow对象,并尝试对窗口使用WASDK的自定义标题栏,完成后尝试调整窗口大小,应用程序发生异常,且没有更多提示

Steps to reproduce the bug

1.Use Visual Studio to create a Winform project template (whether it's .net core or .net framework)

  1. Use nuget gallery to install the windows app sdk extension, add a packaged project (wapproj), and modernize the winform ready
  2. Add winui3 islands to the OnHandleCreated event in the Form1 class of the derived window of the Form window of Winform, and get the corresponding AppWindow of the window
  3. Once the winui3 islands object is displayed, try to customize the title bar using the AppWindow object
  4. After the window custom title bar is completed and the window is fully displayed, try to resize the window, the application is abnormal, and Visual Studio has no more detailed prompts.

1.使用Visual Studio 创建一个Winform 项目模板(无论是.NET CORE 还是 .NET FRAMEWORK) 2.使用nuget gallery安装windows app sdk扩展,添加打包项目(WAPPROJ),对winform准备进行现代化改造 3.在Winform的Form窗口的派生窗口Form1类中的OnHandleCreated事件中添加winui3 islands,并获取窗口对应的AppWindow 4.在winui3 islands对象显示完成后,使用AppWindow对象尝试对标题栏自定义 5.待窗口自定义标题栏完成和窗口完全显示后,尝试调整窗口大小,应用程序发生异常,且visual studio没有更多的详细提示。

Expected behavior

After customizing the title bar for the Winui3 islands (winform) window, resizing the window will not occur abnormally, and the program will run normally.

对Winui3 islands(winform)窗口自定义标题栏后,调整窗口大小不会发生异常,程序能正常运行。

Screenshots

image

79e19e480f70f87c6d0f6aa4e52b8662

image

image

NuGet package version

WinUI 3 - Windows App SDK 1.4.2: 1.4.231008000

Windows version

Windows 11 (22H2): Build 22621

Additional context

“WinformXamlIslands.exe”(Win32): 已加载“D:\Github\WinformXamlIslands\WinformXamlIslandsPackage\bin\x64\Debug\AppX\WinformXamlIslands\WinformXamlIslands.exe”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\ntdll.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\mscoree.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\kernel32.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\KernelBase.dll”。符号已加载,没有源信息。 线程 0x9f98 已退出,返回值为 0 (0x0)。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\advapi32.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\msvcrt.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\sechost.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\rpcrt4.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\shlwapi.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\kernel.appcore.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\version.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\user32.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\win32u.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\gdi32.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\gdi32full.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\vcruntime140_1_clr0400.dll”。已加载符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\msvcp_win.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\ucrtbase_clr0400.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\vcruntime140_clr0400.dll”。已加载符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\ucrtbase.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\imm32.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\combase.dll”。已加载符号。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Windows\System32\combase.dll” “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\psapi.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\987f639e2113a820112aca65fb12396c\mscorlib.ni.dll”。 “WinformXamlIslands.exe”(CLR v4.0.30319: DefaultDomain): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0b77a5c561934e089\mscorlib.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\ole32.dll”。已加载符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\combase.dll”。已加载符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\bcryptprimitives.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\uxtheme.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(CLR v4.0.30319: DefaultDomain): 已加载“D:\Github\WinformXamlIslands\WinformXamlIslandsPackage\bin\x64\Debug\AppX\WinformXamlIslands\WinformXamlIslands.exe”。已加载符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clrjit.dll”。已加载符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\clbcatq.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\Windows.ApplicationModel.dll”。已加载符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\WinTypes.dll”。已加载符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.Xaml.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.Xaml.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.Xaml.winmd” “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.Xaml.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\WinMetadata\Windows.Foundation.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\WinMetadata\Windows.Foundation.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Windows\System32\WinMetadata\Windows.Foundation.winmd” “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\system32\WinMetadata\Windows.Foundation.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Runtime.dll”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Runtime.dll”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Runtime.dll” “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Runtime.dll”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.InteropServices.WindowsRuntime\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Runtime.InteropServices.WindowsRuntime.dll”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.InteropServices.WindowsRuntime\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Runtime.InteropServices.WindowsRuntime.dll”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.InteropServices.WindowsRuntime\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Runtime.InteropServices.WindowsRuntime.dll” “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.InteropServices.WindowsRuntime\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Runtime.InteropServices.WindowsRuntime.dll”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\assembly\NativeImages_v4.0.30319_64\System\4fa015327c8f6de209996c36442169bd\System.ni.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Drawing\8a4609362fa55cb74f4955f7c96686dd\System.Drawing.ni.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Windows.Forms\6db0f565fffad6508237b694e2c77549\System.Windows.Forms.ni.dll”。 “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0b77a5c561934e089\System.Windows.Forms.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。 “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0b77a5c561934e089\System.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。 “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Drawing.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\bcrypt.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.winmd” “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\Windows.StateRepositoryCore.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.ui.xaml.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\oleaut32.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\CoreMessagingXP.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.Windowing.Core.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.Internal.FrameworkUdk.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\urlmon.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\powrprof.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\DWrite.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\d2d1.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\d3d11.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\BCP47Langs.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\profapi.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\dcomp.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\CoreMessaging.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\srvcli.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\iertutil.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\netutils.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\dxgi.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\Microsoft.Internal.FrameworkUdk.System.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\SHCore.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\umpdc.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.Xaml.Controls.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\twinapi.appcore.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\Windows.UI.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\DXCore.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\Windows.UI.Immersive.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\ResourcePolicyClient.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Windows\System32\ResourcePolicyClient.dll” “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\directxdatabasehelper.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.Windows.ApplicationModel.Resources.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\MRM.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\DriverStore\FileRepository\u0378172.inf_amd64_a7d3695b0cbcc9b6\B374167\aticfx64.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\winmm.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\dwmapi.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\BCP47mrm.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Windows\System32\dwmapi.dll” “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\DriverStore\FileRepository\u0378172.inf_amd64_a7d3695b0cbcc9b6\B374167\atiuxp64.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\Windows.Globalization.dll”。已加载符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\DriverStore\FileRepository\u0378172.inf_amd64_a7d3695b0cbcc9b6\B374167\atidxx64.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\setupapi.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\shell32.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\cfgmgr32.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\apphelp.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\amdihk64.dll”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\windows.storage.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Core\b8f14768d1564a407e5711fd562b1c66\System.Core.ni.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Configuration\a1cebec96f3a35218b542eb1e73606f3\System.Configuration.ni.dll”。 “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Configuration.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。 “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0b77a5c561934e089\System.Core.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\D3DSCache.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\userenv.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Xml\5b5f2205971bf115f22d303de0c66247\System.Xml.ni.dll”。 “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0b77a5c561934e089\System.Xml.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\cryptsp.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\rsaenh.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\cryptbase.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\TextShaping.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.2483_none_2714a1b573815e84\comctl32.dll”。符号已加载,没有源信息。 线程 0xa148 已退出,返回值为 0 (0x0)。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\msctf.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0b77a5c561934e089\System.Runtime.WindowsRuntime.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0b77a5c561934e089\System.Runtime.WindowsRuntime.dll”。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0b77a5c561934e089\System.Runtime.WindowsRuntime.dll” “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0b77a5c561934e089\System.Runtime.WindowsRuntime.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Numerics.Vectors\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Numerics.Vectors.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Numerics.Vectors\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Numerics.Vectors.dll”。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Numerics.Vectors\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Numerics.Vectors.dll” “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics.Vectors\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Numerics.Vectors.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Numerics\c304ca3d7627f6a0e371e00d336dbeba\System.Numerics.ni.dll”。 “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0b77a5c561934e089\System.Numerics.dll”。已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\WinMetadata\Windows.Graphics.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\WinMetadata\Windows.Graphics.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Windows\System32\WinMetadata\Windows.Graphics.winmd” “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\system32\WinMetadata\Windows.Graphics.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.22621.2483_none_57ff949ace13d852\GdiPlus.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\WinMetadata\Windows.UI.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\WinMetadata\Windows.UI.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已卸载“C:\Windows\System32\WinMetadata\Windows.UI.winmd” “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\system32\WinMetadata\Windows.UI.winmd”。模块已生成,不包含符号。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\dcompi.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\marshal.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.Composition.OSSupport.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\dwmcorei.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x64__8wekyb3d8bbwe\Microsoft.InputStateManager.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\D3DCompiler_47.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.Input.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.UI.Windowing.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\Microsoft.WindowsAppRuntime.Insights.Resource.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\DataExchange.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\OneCoreUAPCommonProxyStub.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x648wekyb3d8bbwe\wuceffectsi.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\dwmapi.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\Windows.Energy.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\d3d10warp.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\WindowsCodecs.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\TextInputFramework.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\wuceffects.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\oleacc.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\assembly\NativeImages_v4.0.30319_64\Accessibility\7346e7a81a887288ccdc3d79f17a7f6a\Accessibility.ni.dll”。 “WinformXamlIslands.exe”(CLR v4.0.30319: WinformXamlIslands.exe): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0b03f5f7f11d50a3a\Accessibility.dll”。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\sxs.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\XamlDiagnostics\x64\WinUI3\Microsoft.VisualStudio.DesignTools.WinUITap.dll”。符号已加载,没有源信息。 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\InputHost.dll”。符号已加载,没有源信息。 Microsoft.UI.Xaml.dll!00007FFDBB6EE902: 80070057 - E_INVALIDARG Microsoft.UI.Xaml.dll!00007FFDBB6EE902: 80070057 - E_INVALIDARG Microsoft.UI.Xaml.dll!00007FFDBB6EE902: 80070057 - E_INVALIDARG “WinformXamlIslands.exe”(Win32): 已加载“C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.1010.1349.0_x64__8wekyb3d8bbwe\Microsoft.DirectManipulation.dll”。符号已加载,没有源信息。 onecoreuap\windows\frameworkudk\warppal.cpp(783)\Microsoft.Internal.FrameworkUdk.dll!00007FFDC12B2763: (caller: 00007FFDC12B400D) ReturnHr(1) tid(a3fc) 80004002 涓嶆敮鎸佹鎺ュ彛 onecoreuap\windows\frameworkudk\warppal.cpp(783)\Microsoft.Internal.FrameworkUdk.dll!00007FFDC12B2763: (caller: 00007FFDC12B400D) ReturnHr(2) tid(a3fc) 80004002 涓嶆敮鎸佹鎺ュ彛 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\xmllite.dll”。符号已加载,没有源信息。 Microsoft.UI.Xaml.dll!00007FFDBAE3D12D: 80070057 - E_INVALIDARG onecoreuap\windows\frameworkudk\warppal.cpp(783)\Microsoft.Internal.FrameworkUdk.dll!00007FFDC12B2763: (caller: 00007FFDC12B400D) ReturnHr(3) tid(6498) 80004002 涓嶆敮鎸佹鎺ュ彛 “WinformXamlIslands.exe”(Win32): 已加载“C:\Windows\System32\ninput.dll”。符号已加载,没有源信息。 0x00007FFDC08FFBC5 (Microsoft.UI.Input.dll) (WinformXamlIslands.exe 中)处有未经处理的异常: 0xC0000602: 发生了快速异常检测失败。将不会调用异常处理程序,并且进程将立即终止。。

程序“[28708] WinformXamlIslands.exe”已退出,返回值为 0 (0x0)。

测试程序:(TestProgram) WinformXamlIslands.zip

DarranRowe commented 10 months ago

Well, as mentioned in the other issue, I do not see this in a Windows API application. I have tried both packaged and unpackaged.

I did take a little look at the provided project. The application exits with a fail fast error from Microsoft.UI.Input.dll. However, I'm not really experienced enough with C# to figure things out right now.

castorix commented 10 months ago

I had also done some tests in C# with DesktopWindowXamlSource in WinForms and WPF + ExtendsContentIntoTitleBar and I get too a RaiseFailFastException which terminates the app when I resize the window (there is a GetProp with "Microsoft.Windows.System.WindowsMessageDeliveryAdapter" which succeeds and then it crashes) I cannot test in C++ (C++/WinRT takes hours to compile on my old PC), but if it works as @DarranRowe said, maybe there is something obvious I missed...

DarranRowe commented 10 months ago

The only properties on the window are a GUID and an ATOM when working with the Windows API. The ATOM is added with ExtendsConentIntoTitleBar, but the GUID always seems to be there. I'll upload my C++ project up for reference after I fix a couple of things.

--Edit-- XamlIslandTest3.zip

Gaoyifei1011 commented 9 months ago

The only properties on the window are a GUID and an ATOM when working with the Windows API. The ATOM is added with ExtendsConentIntoTitleBar, but the GUID always seems to be there. I'll upload my C++ project up for reference after I fix a couple of things.

--Edit-- XamlIslandTest3.zip

找到 Winui3 islands 子窗口,使用 SetSubClass 函数为该窗口句柄添加窗口过程。 Locate the Winui3 islands subwindow and use the SetSubClass function to add a window procedure to the window handle.

        desktopSourceSubClassProc = new SUBCLASSPROC(OnDesktopSourceSubClassProc);
        Comctl32Library.SetWindowSubclass((IntPtr)DesktopWindowXamlSource.SiteBridge.WindowId.Value, desktopSourceSubClassProc, 100, IntPtr.Zero);

处理 WM_ERASEBKGND 和 WM_NCPAINT 消息 Handle WM_ERASEBKGND and WM_NCPAINT messages

    private IntPtr OnDesktopSourceSubClassProc(IntPtr hWnd, WindowMessage uMsg, IntPtr wParam, IntPtr lParam, uint uIdSubclass, IntPtr dwRefData)
    {
        if (uMsg == WindowMessage.WM_ERASEBKGND || uMsg == WindowMessage.WM_NCPAINT)
        {
            return IntPtr.Zero;
        }

        return Comctl32Library.DefSubclassProc(hWnd, uMsg, wParam, lParam);
    }

我的一位好友帮我找到了一个临时的解决方案,我个人感觉这样的做法不是很好,故希望微软团队能在未来的版本中修复这一问题。 A friend of mine helped me find a temporary solution, which I personally feel is not very good, so I hope the Microsoft team can fix this issue in a future release.