From 21bf0a87c9e199f664d68e8630931f908f08d4ea Mon Sep 17 00:00:00 2001 From: UrbanCMC Date: Mon, 28 Aug 2023 17:28:44 +0200 Subject: [PATCH] Fix deadlock when loading new settings --- Wabbajack.Configuration/MainSettings.cs | 4 ++-- Wabbajack.Services.OSIntegrated/ServiceExtensions.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Wabbajack.Configuration/MainSettings.cs b/Wabbajack.Configuration/MainSettings.cs index 45eadd8b..5b8bf4eb 100644 --- a/Wabbajack.Configuration/MainSettings.cs +++ b/Wabbajack.Configuration/MainSettings.cs @@ -5,9 +5,9 @@ public class MainSettings public const string SettingsFileName = "app_settings"; private const int SettingsVersion = 1; - public int CurrentSettingsVersion { get; private set; } + public int CurrentSettingsVersion { get; set; } - public PerformanceSettings PerformanceSettings { get; } = new(); + public PerformanceSettings PerformanceSettings { get; set; } = new(); public bool Upgrade() { diff --git a/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs b/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs index 87ce587f..d89cf4e2 100644 --- a/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs +++ b/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs @@ -100,8 +100,8 @@ public static class ServiceExtensions MainSettings GetAppSettings(IServiceProvider provider, string name) { - var settingsManager = provider.GetService(); - var settings = settingsManager!.Load(name).Result; + var settingsManager = provider.GetRequiredService(); + var settings = Task.Run(() => settingsManager.Load(name)).Result; if (settings.Upgrade()) { settingsManager.Save(MainSettings.SettingsFileName, settings).FireAndForget();