Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Lite/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,15 @@ private async void MainWindow_Closing(object? sender, System.ComponentModel.Canc
_statusTimer.Stop();

_closingCleanupDone = true;
Close();

/* Re-close on the next dispatcher cycle, not synchronously here. If the awaits above all
completed without ever suspending (MCP off, collector already idle), we're still inside
WPF's Closing event with Window._isClosing == true, and a synchronous Close() re-enters
InternalClose → VerifyNotClosing() throws "Cannot ... call Close ... while a Window is
closing" (#1050 follow-up). BeginInvoke lets this Closing event fully unwind — clearing
_isClosing — before the real close runs; the second pass returns early on
_closingCleanupDone and the window closes for real. */
_ = Dispatcher.BeginInvoke(new Action(Close));
}

private void ServerTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
Expand Down
Loading