From 3beea79b383bbb396d06a431ba8e465abbed39bf Mon Sep 17 00:00:00 2001 From: Tomas Agustin Raies Date: Tue, 5 May 2020 16:01:55 -0700 Subject: [PATCH] Workaround for Settings ViewModel tests (#2693) --- .../GeneralSettings.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs index 6e3ed59038..6b4712ff96 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs @@ -59,7 +59,15 @@ namespace Microsoft.PowerToys.Settings.UI.Lib this.AutoDownloadUpdates = false; this.Theme = "system"; this.SystemTheme = "light"; - this.PowertoysVersion = interop.CommonManaged.GetProductVersion(); + try + { + this.PowertoysVersion = DefaultPowertoysVersion(); + } + catch + { + this.PowertoysVersion = "v0.0.0"; + } + this.Enabled = new EnabledModules(); this.CustomActionName = string.Empty; } @@ -69,5 +77,10 @@ namespace Microsoft.PowerToys.Settings.UI.Lib { return JsonSerializer.Serialize(this); } + + private string DefaultPowertoysVersion() + { + return interop.CommonManaged.GetProductVersion(); + } } }