Skip to content

Commit 8480f25

Browse files
Keith MahoneyCopilot
andcommitted
fix(updater): anchor WinUI runtime so transient dialog close doesn't kill in-flight download
UpdateDialog is a WindowEx (its own full WinUI Window), not a ContentDialog. On the startup update path it is the only window in the process. WinUI 3 Desktop's default DispatcherShutdownMode is OnLastWindowClose, so clicking 'Download' (which calls Close() on the dialog) shuts down the WinUI runtime mid-extraction. The Updatum-managed ZipFile.ExtractToDirectory only got ~199 of 1505 files written to %TEMP% before the process was terminated, the .bat script that drives the in-place file replacement was never written, and the install dir was never updated. Because the shutdown came from the native side it bypassed AppDomain.ProcessExit, so no 'Process exiting (ExitCode=...)' line was logged and no managed exception was thrown, making the failure silent. Switch the DispatcherShutdownMode to OnExplicitShutdown so the runtime only exits when we call Application.Exit() (which we already do in the existing shutdown paths). The keep-alive window remains because it is still required as a persistent XamlRoot host for ContentDialogs that fire when no Hub window is open. Verified on Windows by upgrading v0.5.1 -> v0.6.0: (Get-Item ".\OpenClaw.Tray.WinUI.exe").VersionInfo.ProductVersion 0.6.0+... Co-authored-by: Copilot <[email protected]>
1 parent f4d4793 commit 8480f25

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎src/OpenClaw.Tray.WinUI/App.xaml.cs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,16 @@ _dispatcherQueue is null
460460
// Register URI scheme on first run
461461
DeepLinkHandler.RegisterUriScheme();
462462

463+
// Anchor the WinUI runtime so transient windows (UpdateDialog,
464+
// setup wizard, etc.) don't terminate the process when closed.
465+
// WinUI 3 Desktop's default DispatcherShutdownMode is
466+
// OnLastWindowClose — without this override, closing the
467+
// UpdateDialog on the startup path (when it is the only window)
468+
// would shut down the WinUI runtime mid-flight and kill the
469+
// in-progress download/extraction. We still control shutdown
470+
// explicitly via Application.Exit().
471+
DispatcherShutdownMode = DispatcherShutdownMode.OnExplicitShutdown;
472+
463473
// Check for updates before launching. Skip in test instances — no UI dialogs,
464474
// no network calls, no startup delay.
465475
if (DataDirOverride is null &&

0 commit comments

Comments
 (0)