dispose single instance checker in the actual scope that it is used.
MODIFY
WalletWasabi.Fluent.Desktop/Program.cs
WalletWasabi.Fluent.Desktop/Program.cs
@@ -55,14 +55,15 @@ public class Program
}
Exception? exceptionToReport = null;
- SingleInstanceChecker? singleInstanceChecker = null;
if (runGui)
{
try
{
var (uiConfig, config) = LoadOrCreateConfigs(dataDir);
- singleInstanceChecker = new SingleInstanceChecker(config.Network);
+
+ using (var singleInstanceChecker = new SingleInstanceChecker(config.Network))
+ {
singleInstanceChecker.EnsureSingleOrThrowAsync().GetAwaiter().GetResult();
Global = CreateGlobal(dataDir, uiConfig, config);
@@ -74,9 +75,11 @@ public class Program
Logger.LogSoftwareStarted("Wasabi GUI");
BuildAvaloniaApp()
- .AfterSetup(_ => ThemeHelper.ApplyTheme(Global.UiConfig.DarkModeEnabled ? Theme.Dark : Theme.Light))
+ .AfterSetup(_ =>
+ ThemeHelper.ApplyTheme(Global.UiConfig.DarkModeEnabled ? Theme.Dark : Theme.Light))
.StartWithClassicDesktopLifetime(args);
}
+ }
catch (OperationCanceledException ex)
{
Logger.LogDebug(ex);
@@ -92,11 +95,6 @@ public class Program
TerminateService.Terminate();
- if (singleInstanceChecker is { } single)
- {
- Task.Run(async () => await single.DisposeAsync()).Wait();
- }
-
if (exceptionToReport is { })
{
// Trigger the CrashReport process if required.

MODIFY
WalletWasabi.Fluent.Desktop/WalletWasabi.Fluent.Desktop.csproj
WalletWasabi.Fluent.Desktop/WalletWasabi.Fluent.Desktop.csproj
<LangVersion>latest</LangVersion>
<NoWarn>1701;1702;1705;1591;1573;CA1031;CA1822</NoWarn>
<Nullable>enable</Nullable>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<InvariantGlobalization>true</InvariantGlobalization>

dispose single instance checker in the actual scope that it is used.