Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinUI3 in Desktop template App crashes when activating two Windows in App.xaml.cs #9008

Open
minesworld opened this issue Oct 21, 2023 · 2 comments
Labels
bug Something isn't working team-Markup Issue for the Markup team

Comments

@minesworld
Copy link

Describe the bug

VisualStudio 2022 tries to attach another debugger when App.xaml.cs tries to activate two Windows:

protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
    m_window = new MainWindow();
    m_window.Activate();

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

Output:
The program '[26132] DebuggerCrash.exe' has exited with code 3221225477 (0xc0000005) 'Access violation'.

This happens (DebuggerCrash project) using

  • Microsoft.WindowsAppSDK 1.4.231008000
  • Microsoft.Windows.SDK.BuildTools 10.0.22621.756

This does not happen (DebuggerNoCrash project) using

  • Microsoft.WindowsAppSDK 1.3.230602002
  • Microsoft.Windows.SDK.BuildTools 10.0.22621.755

Both projects run without any issues if started WITHOUT debugging from VisualStudio 2022

Steps to reproduce the bug

  1. download the AppSDKBugs repo from https://github.com/minesworld/AppSDKBugs
  2. debug the DebuggerCrash project

Expected behavior

should open and continue debugging without any issues

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.4.2: 1.4.231008000

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@DarranRowe
Copy link

Yes, this should be known and related to the In-App Toolbar.

Screenshot 2023-10-02 185808

As a workaround, you can disable the In-App Toolbar from the Live Visual Tree tool window in Visual Studio.

Screenshot 2023-10-02 185436

This only appears when Visual Studio is debugging a Xaml window.

@minesworld
Copy link
Author

Thanks a lot. Spent hours on that. Seems that "should be known" didn't work in my case. Wonder if there could be solution within the generated XAML startup code to check if that option is on and WriteLine a statement....

@ranjeshj ranjeshj added the team-Markup Issue for the Markup team label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

3 participants