Move UIConfig creation and initialisation into Global and before the UI is even started, as UI will not work without it.
MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -87,9 +87,24 @@ namespace WalletWasabi.Gui
HostedServices = new HostedServices();
}
- public void InitializeUiConfig(UiConfig uiConfig)
+ public async Task<bool> InitializeUiConfigAsync()
{
- UiConfig = Guard.NotNull(nameof(uiConfig), uiConfig);
+ try
+ {
+ var uiConfigFilePath = Path.Combine(DataDir, "UiConfig.json");
+ var uiConfig = new UiConfig(uiConfigFilePath);
+ await uiConfig.LoadOrCreateDefaultFileAsync();
+
+ UiConfig = uiConfig;
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Logger.LogError(ex);
+ }
+
+ return false;
}
private int _isDesperateDequeuing = 0;

MODIFY
WalletWasabi.Gui/Program.cs
WalletWasabi.Gui/Program.cs
@@ -42,6 +42,16 @@ namespace WalletWasabi.Gui
return;
}
+ if (await Global.InitializeUiConfigAsync())
+ {
+ Logger.LogInfo($"{nameof(Global.UiConfig)} is successfully initialized.");
+ }
+ else
+ {
+ Logger.LogError("Failed to initialize UIConfig.");
+ return;
+ }
+
Logger.LogSoftwareStarted("Wasabi GUI");
BuildAvaloniaApp().StartShellApp("Wasabi Wallet", AppMainAsync, args);

Move UIConfig creation and initialisation into Global and before the UI is even started, as UI will not work without it.