瀏覽代碼

Handle individual malformed settings

Skip deserialization (or use default) instead of resetting all settings.
Daniel Chalmers 2 年之前
父節點
當前提交
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()