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
11 changes: 11 additions & 0 deletions src/PerfView/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,17 @@ private void Window_Closed(object sender, EventArgs e)
// DO NOT call Environment.Exit(0) under tests, it will kill the test runner, and tests won't complete.
if (!_testing)
{
// Dispose all WebView2 browser controls before exiting. Environment.Exit triggers
// finalizers, and the WebView2 finalizer crashes if the underlying COM objects have
// already been torn down during process shutdown.
foreach (Window window in Application.Current.Windows)
{
if (window is WebBrowserWindow browserWindow)
{
browserWindow.Browser?.Dispose();
}
}

Environment.Exit(0);
}
}
Expand Down