Skip to content

Commit 53ff55a

Browse files
kmahoneKeith MahoneyCopilot
authored
fix(updater): anchor WinUI runtime so transient dialog close doesn't kill in-flight download (#644)
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: Keith Mahoney <you@example.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bfeb3b5 commit 53ff55a

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
@@ -374,6 +374,16 @@ _dispatcherQueue is null
374374
// Register URI scheme on first run
375375
DeepLinkHandler.RegisterUriScheme();
376376

377+
// Anchor the WinUI runtime so transient windows (UpdateDialog,
378+
// setup wizard, etc.) don't terminate the process when closed.
379+
// WinUI 3 Desktop's default DispatcherShutdownMode is
380+
// OnLastWindowClose — without this override, closing the
381+
// UpdateDialog on the startup path (when it is the only window)
382+
// would shut down the WinUI runtime mid-flight and kill the
383+
// in-progress download/extraction. We still control shutdown
384+
// explicitly via Application.Exit().
385+
DispatcherShutdownMode = DispatcherShutdownMode.OnExplicitShutdown;
386+
377387
// Check for updates before launching. Skip in test instances — no UI dialogs,
378388
// no network calls, no startup delay.
379389
if (DataDirOverride is null &&

0 commit comments

Comments
 (0)