-
Notifications
You must be signed in to change notification settings - Fork 701
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
[Regression] Closing a window from an AppBarButton in overflow inside a CommandBar crashes the app #10115
Comments
Would you be able to provide a call stack? |
@karkarl How can I give you the call stack? Visual Studio doesn't manage this exception. |
I can reproduce this also when I have a menubar with a flyout and create a new window from it while closing the old one. Here is my repro project: This error does not happen with 1.5.241107002. It got introduced by 1.6.xxxxx For the case that you don't want to open the project here are the steps to reproduce:
<?xml version="1.0" encoding="utf-8" ?>
<Window
x:Class="CrashRepro.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:CrashRepro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="CrashRepro"
mc:Ignorable="d">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<MenuBar Name="MbMenu">
<MenuBarItem Title="File">
<MenuFlyoutItem Click="myButton_Click" Text="NewWindow" />
</MenuBarItem>
</MenuBar>
</StackPanel>
</Window>
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Windows.Foundation;
using Windows.Foundation.Collections;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace CrashRepro
{
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
}
private void myButton_Click(object sender, RoutedEventArgs e)
{
MainWindow mw = new();
mw.Activate();
Close();
}
}
}
|
I was able to repro the issue. It looks like the same callstack as the one in this issue: #10127 |
Describe the bug
If the AppBarButton click event closes the window it's located in, the whole app crashes.
This is a regression bug from the 1.5.241001000 version.
This is the error I get from the windows event viewer:
Steps to reproduce the bug
Run the attached repo and click a few times on the command bar button until the app crashes (1-5 times).
https://github.com/user-attachments/assets/e93c0b4c-346f-4897-944a-5ad120c7cd98
Expected behavior
The app doesn't crash.
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002
Windows version
Windows 11 (22H2): Build 22621
Additional context
No response
The text was updated successfully, but these errors were encountered: