Skip to content

[Bug]: Startup — a fault while the main window is built leaves SysManager running with no window and no tray icon, and later launches only hand over to it #2863

Open

Description

@laurentiu021

Problem

App.OnUi sets e.Handled = true for every dispatcher exception and never checks whether startup has finished. It is wired early in OnStartup, before the DI build, the tray, the theme and the StartupUri window. MainWindow.xaml builds MainWindowViewModel as its DataContext, and that constructor resolves the network state and the Dashboard, Dark Mode, Standby, About and Welcome view models eagerly, with no try/catch. A throw anywhere in that chain reaches OnUi, which shows "Something went wrong, but SysManager is still running." and returns.

After OK there is no window. ShutdownMode is OnExplicitShutdown, and the tray icon is created only from MainWindow.OnSourceInitialized, so there is no icon to exit from either. The process stays alive and keeps the single-instance mutex, so every later launch only hands over to it through the pipe and exits: if the fault came before the window existed nothing appears, and if it came while the window was being built the old process shows that half-built window. Nothing writes last-crash.json, because only OnDomain writes it ("Never written from OnUi, which handles the exception and keeps running"). Without that handler, the same exception would reach OnDomain, which logs it, writes the marker and lets the process end; as it is, a fault at startup is worse than a crash, and the user has to end the process in Task Manager or restart Windows. The CHANGELOG has recorded faults of this kind before ("that gap could throw in the unprotected startup window").

Steps to reproduce

  1. Make any eager view model's constructor throw (for example, a store it reads at construction raising an exception it does not catch).
  2. Start SysManager and press OK on the error box. There is no window and no tray icon, and starting SysManager again either does nothing or shows a window with no content.

Expected behavior

A fault before the main window has loaded ends the process with a crash marker that the next start reports, and the next launch opens normally.

Proposed fix

Affected tab

Startup (every tab).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions