window events are invalid and cannot be closed or clicked
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
The non-modal window is closed as the owner. Other window events are invalid and cannot be closed or clicked.
### Reproduction Steps
```
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
Window1 window = null;
private void Button_Click(object sender, RoutedEventArgs e)
{
window = new Window1();
window.Show();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Window1 window2 = new Window1();
window2.Owner = window;
Task.Run(() => {
Thread.Sleep(3000);
System.Windows.Application.Current.Dispatcher.BeginInvoke((System.Action)(() =>
{
window.Close(); //Causes other window events to invalid
}));
});
window2.ShowDialog();
}
}
```
### Expected behavior
Works properly
### Actual behavior
Causes other window events to invalid
### Regression?
This problem exists testing with .Net 5 or .Net 9
### Known Workarounds
_No response_
### Impact
_No response_
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.