Initialize UI Config before time
MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -76,6 +76,8 @@ namespace WalletWasabi.Gui
public static JsonRpcServer RpcServer { get; private set; }
public Global()
+ {
+ using (BenchmarkLogger.Measure())
{
StoppingCts = new CancellationTokenSource();
DataDir = EnvironmentHelpers.GetDataDir(Path.Combine("WalletWasabi", "Client"));
@@ -84,6 +86,9 @@ namespace WalletWasabi.Gui
Logger.InitializeDefaults(Path.Combine(DataDir, "Logs.txt"));
+ UiConfig = new UiConfig(Path.Combine(DataDir, "UiConfig.json"));
+ UiConfig.LoadOrCreateDefaultFile();
+
HostedServices = new HostedServices();
WalletManager = new WalletManager(new WalletDirectories(DataDir));
@@ -92,25 +97,6 @@ namespace WalletWasabi.Gui
WalletManager.OnDequeue += WalletManager_OnDequeue;
WalletManager.WalletRelevantTransactionProcessed += WalletManager_WalletRelevantTransactionProcessed;
}
-
- public bool InitializeUiConfig()
- {
- try
- {
- var uiConfigFilePath = Path.Combine(DataDir, "UiConfig.json");
- var uiConfig = new UiConfig(uiConfigFilePath);
- uiConfig.LoadOrCreateDefaultFile();
-
- UiConfig = uiConfig;
-
- return true;
- }
- catch (Exception ex)
- {
- Logger.LogError(ex);
- }
-
- return false;
}
private bool InitializationCompleted { get; set; } = false;

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

MODIFY
WalletWasabi/Bases/ConfigBase.cs
WalletWasabi/Bases/ConfigBase.cs
@@ -67,9 +67,10 @@ namespace WalletWasabi.Bases
{
LoadFile();
}
- catch (JsonException)
+ catch (Exception ex)
{
Logger.LogInfo($"{GetType().Name} file has been deleted because it was corrupted. Recreated default version at path: `{FilePath}`.");
+ Logger.LogWarning(ex);
}
}

Initialize UI Config before time