Просмотр исходного кода

Handle individual malformed settings

Skip deserialization (or use default) instead of resetting all settings.
Daniel Chalmers 2 лет назад
Родитель
Сommit
5a39333f11
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      DesktopClock/Properties/Settings.cs

+ 5 - 1
DesktopClock/Properties/Settings.cs

@@ -16,7 +16,11 @@ public sealed class Settings : INotifyPropertyChanged, IDisposable
 
     private static readonly JsonSerializerSettings _jsonSerializerSettings = new()
     {
-        Formatting = Formatting.Indented
+        Formatting = Formatting.Indented,
+        Error = (_, e) =>
+        {
+            e.ErrorContext.Handled = true;
+        },
     };
 
     private Settings()