Fix config file corruption (actually happened)
MODIFY
WalletWasabi.Backend/Config.cs
WalletWasabi.Backend/Config.cs
@@ -158,16 +158,16 @@ namespace WalletWasabi.Backend
string jsonString = await File.ReadAllTextAsync(FilePath, Encoding.UTF8);
var config = JsonConvert.DeserializeObject<Config>(jsonString);
- Network = config.Network ?? Network;
- BitcoinRpcConnectionString = config.BitcoinRpcConnectionString ?? BitcoinRpcConnectionString;
+ Network = config?.Network ?? Network;
+ BitcoinRpcConnectionString = config?.BitcoinRpcConnectionString ?? BitcoinRpcConnectionString;
- MainNetBitcoinP2pEndPoint = config.MainNetBitcoinP2pEndPoint ?? MainNetBitcoinP2pEndPoint;
- TestNetBitcoinP2pEndPoint = config.TestNetBitcoinP2pEndPoint ?? TestNetBitcoinP2pEndPoint;
- RegTestBitcoinP2pEndPoint = config.RegTestBitcoinP2pEndPoint ?? RegTestBitcoinP2pEndPoint;
+ MainNetBitcoinP2pEndPoint = config?.MainNetBitcoinP2pEndPoint ?? MainNetBitcoinP2pEndPoint;
+ TestNetBitcoinP2pEndPoint = config?.TestNetBitcoinP2pEndPoint ?? TestNetBitcoinP2pEndPoint;
+ RegTestBitcoinP2pEndPoint = config?.RegTestBitcoinP2pEndPoint ?? RegTestBitcoinP2pEndPoint;
- MainNetBitcoinCoreRpcEndPoint = config.MainNetBitcoinCoreRpcEndPoint ?? MainNetBitcoinCoreRpcEndPoint;
- TestNetBitcoinCoreRpcEndPoint = config.TestNetBitcoinCoreRpcEndPoint ?? TestNetBitcoinCoreRpcEndPoint;
- RegTestBitcoinCoreRpcEndPoint = config.RegTestBitcoinCoreRpcEndPoint ?? RegTestBitcoinCoreRpcEndPoint;
+ MainNetBitcoinCoreRpcEndPoint = config?.MainNetBitcoinCoreRpcEndPoint ?? MainNetBitcoinCoreRpcEndPoint;
+ TestNetBitcoinCoreRpcEndPoint = config?.TestNetBitcoinCoreRpcEndPoint ?? TestNetBitcoinCoreRpcEndPoint;
+ RegTestBitcoinCoreRpcEndPoint = config?.RegTestBitcoinCoreRpcEndPoint ?? RegTestBitcoinCoreRpcEndPoint;
if (TryEnsureBackwardsCompatibility(jsonString))
{

MODIFY
WalletWasabi.Gui/Config.cs
WalletWasabi.Gui/Config.cs
@@ -284,29 +284,29 @@ namespace WalletWasabi.Gui
var config = JsonConvert.DeserializeObject<Config>(jsonString);
- Network = config.Network ?? Network;
+ Network = config?.Network ?? Network;
- MainNetBackendUriV3 = config.MainNetBackendUriV3 ?? MainNetBackendUriV3;
- TestNetBackendUriV3 = config.TestNetBackendUriV3 ?? TestNetBackendUriV3;
- MainNetFallbackBackendUri = config.MainNetFallbackBackendUri ?? MainNetFallbackBackendUri;
- TestNetFallbackBackendUri = config.TestNetFallbackBackendUri ?? TestNetFallbackBackendUri;
- RegTestBackendUriV3 = config.RegTestBackendUriV3 ?? RegTestBackendUriV3;
+ MainNetBackendUriV3 = config?.MainNetBackendUriV3 ?? MainNetBackendUriV3;
+ TestNetBackendUriV3 = config?.TestNetBackendUriV3 ?? TestNetBackendUriV3;
+ MainNetFallbackBackendUri = config?.MainNetFallbackBackendUri ?? MainNetFallbackBackendUri;
+ TestNetFallbackBackendUri = config?.TestNetFallbackBackendUri ?? TestNetFallbackBackendUri;
+ RegTestBackendUriV3 = config?.RegTestBackendUriV3 ?? RegTestBackendUriV3;
- UseTor = config.UseTor ?? UseTor;
- TorSocks5EndPoint = config.TorSocks5EndPoint ?? TorSocks5EndPoint;
+ UseTor = config?.UseTor ?? UseTor;
+ TorSocks5EndPoint = config?.TorSocks5EndPoint ?? TorSocks5EndPoint;
- MainNetBitcoinP2pEndPoint = config.MainNetBitcoinP2pEndPoint ?? MainNetBitcoinP2pEndPoint;
- TestNetBitcoinP2pEndPoint = config.TestNetBitcoinP2pEndPoint ?? TestNetBitcoinP2pEndPoint;
- RegTestBitcoinP2pEndPoint = config.RegTestBitcoinP2pEndPoint ?? RegTestBitcoinP2pEndPoint;
+ MainNetBitcoinP2pEndPoint = config?.MainNetBitcoinP2pEndPoint ?? MainNetBitcoinP2pEndPoint;
+ TestNetBitcoinP2pEndPoint = config?.TestNetBitcoinP2pEndPoint ?? TestNetBitcoinP2pEndPoint;
+ RegTestBitcoinP2pEndPoint = config?.RegTestBitcoinP2pEndPoint ?? RegTestBitcoinP2pEndPoint;
- MixUntilAnonymitySet = config.MixUntilAnonymitySet ?? MixUntilAnonymitySet;
- PrivacyLevelSome = config.PrivacyLevelSome ?? PrivacyLevelSome;
- PrivacyLevelFine = config.PrivacyLevelFine ?? PrivacyLevelFine;
- PrivacyLevelStrong = config.PrivacyLevelStrong ?? PrivacyLevelStrong;
+ MixUntilAnonymitySet = config?.MixUntilAnonymitySet ?? MixUntilAnonymitySet;
+ PrivacyLevelSome = config?.PrivacyLevelSome ?? PrivacyLevelSome;
+ PrivacyLevelFine = config?.PrivacyLevelFine ?? PrivacyLevelFine;
+ PrivacyLevelStrong = config?.PrivacyLevelStrong ?? PrivacyLevelStrong;
- DustThreshold = config.DustThreshold ?? DustThreshold;
+ DustThreshold = config?.DustThreshold ?? DustThreshold;
- ServiceConfiguration = config.ServiceConfiguration ?? ServiceConfiguration;
+ ServiceConfiguration = config?.ServiceConfiguration ?? ServiceConfiguration;
// Just debug convenience.
_backendUri = GetCurrentBackendUri();

MODIFY
WalletWasabi.Gui/UiConfig.cs
WalletWasabi.Gui/UiConfig.cs
@@ -119,15 +119,15 @@ namespace WalletWasabi.Gui
string jsonString = await File.ReadAllTextAsync(FilePath, Encoding.UTF8);
var config = JsonConvert.DeserializeObject<UiConfig>(jsonString);
- WindowState = config.WindowState ?? WindowState;
- Height = config.Height ?? Height;
- Width = config.Width ?? Width;
- FeeTarget = config.FeeTarget ?? FeeTarget;
- FeeDisplayFormat = config.FeeDisplayFormat ?? FeeDisplayFormat;
- Autocopy = config.Autocopy ?? Autocopy;
- LurkingWifeMode = config.LurkingWifeMode ?? LurkingWifeMode;
- LockScreenActive = config.LockScreenActive ?? LockScreenActive;
- LockScreenPinHash = config.LockScreenPinHash ?? LockScreenPinHash;
+ WindowState = config?.WindowState ?? WindowState;
+ Height = config?.Height ?? Height;
+ Width = config?.Width ?? Width;
+ FeeTarget = config?.FeeTarget ?? FeeTarget;
+ FeeDisplayFormat = config?.FeeDisplayFormat ?? FeeDisplayFormat;
+ Autocopy = config?.Autocopy ?? Autocopy;
+ LurkingWifeMode = config?.LurkingWifeMode ?? LurkingWifeMode;
+ LockScreenActive = config?.LockScreenActive ?? LockScreenActive;
+ LockScreenPinHash = config?.LockScreenPinHash ?? LockScreenPinHash;
}
/// <inheritdoc />

Fix config file corruption (actually happened)