do not cancel subscription, it needs to be alive during software lifetime
MODIFY
WalletWasabi.Fluent/ApplicationStateManager.cs
WalletWasabi.Fluent/ApplicationStateManager.cs
@@ -2,6 +2,7 @@ using System.ComponentModel;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Avalonia.Controls.ApplicationLifetimes;
+using ReactiveUI;
using WalletWasabi.Fluent.Providers;
using WalletWasabi.Fluent.State;
using WalletWasabi.Fluent.ViewModels;
@@ -44,6 +45,11 @@ public class ApplicationStateManager : IMainWindowService
_stateMachine = new StateMachine<State, Trigger>(State.InitialState);
ApplicationViewModel = new ApplicationViewModel(this);
+ Observable
+ .FromEventPattern(Services.SingleInstanceChecker, nameof(SingleInstanceChecker.OtherInstanceStarted))
+ .ObserveOn(RxApp.MainThreadScheduler)
+ .Subscribe(_ => _stateMachine.Fire(Trigger.Show));
+
_stateMachine.Configure(State.InitialState)
.InitialTransition(State.Open)
.OnTrigger(Trigger.ShutdownRequested, () => lifetime.Shutdown())
@@ -136,11 +142,6 @@ public class ApplicationStateManager : IMainWindowService
})
.DisposeWith(_compositeDisposable);
- Observable
- .FromEventPattern(Services.SingleInstanceChecker, nameof(SingleInstanceChecker.OtherInstanceStarted))
- .Subscribe(_ => _stateMachine.Fire(Trigger.Show))
- .DisposeWith(_compositeDisposable);
-
_lifetime.MainWindow = result;
result.Show();

do not cancel subscription, it needs to be alive during software lifetime