microsoft / microsoft-ui-xaml

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

[LiveVisualTree] Unhandled exception Win32 when creating two and more windows #8975

Open steam3d opened 1 year ago

steam3d commented 1 year ago

Describe the bug

Visual Studio 2022 17.7 shows "Unhandled exception Win32" when I run debuging the MultiWindowError project that creates two window after update Microsoft.WindowsAppSDk from 1.2.230217.4 to 1.4.230913002.

Using "Try catch" on OnLaunched does not cath any error as well as UnhandledException. The MultiWindowError works correctly when I run it without debugging

I could not able to check Win32 exception, because Visual Studio stucks when I try to detach current debagger and attach another one. I also found hard fix. When I adding a delay between creating windows 200ms and more, the application debug run without exception.

m_window = new MainWindow();
m_window.Activate();

await Task.Delay(200);

m_window1 = new MainWindow();
m_window1.Activate();

Steps to reproduce the bug

  1. Clone repo https://github.com/steam3d/MultiWindowError/
  2. Run debugging session

Expected behavior

Application will be debugging without exception how it was on Microsoft.WindowsAppSDk from 1.2.230217.4

Screenshots

https://github.com/microsoft/WindowsAppSDK/assets/30986874/1053dd66-8a4c-4c45-8657-6578be6361c7

NuGet package version

Windows App SDK 1.4.1: 1.4.230913002

Packaging type

No response

Windows version

No response

IDE

No response

Additional context

No response

DarranRowe commented 1 year ago

Try disabling the Xaml In App Toolbar. I remember there being a problem with this toolbar that can cause crashes.

steam3d commented 1 year ago

@DarranRowe it is disabled, but I only have xml image

steam3d commented 1 year ago

I also tired disable this image

DarranRowe commented 1 year ago

If you haven't changed any settings, then your video shows that it is enabled. It is that little tool bar that shows up by default at the top of your application window's Xaml content. This shows in your video while you are showing the application works with 1.2.

Screenshot 2023-10-02 185808

To disable this, you need to open the Live Visual Tree tool window in Visual Studio while your Xaml application is running and disable the tool bar there.

Screenshot 2023-10-02 185436

This tool window only shows up while an application with a Xaml host is running.

steam3d commented 1 year ago

@DarranRowe Yes. When this option is turned off everything fine. When I enable it the app immediately crashes