Explorar o código

Handle individual malformed settings

Skip deserialization (or use default) instead of resetting all settings.
Daniel Chalmers %!s(int64=2) %!d(string=hai) anos
pai
achega
5a39333f11
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  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()
     private static readonly JsonSerializerSettings _jsonSerializerSettings = new()
     {
     {
-        Formatting = Formatting.Indented
+        Formatting = Formatting.Indented,
+        Error = (_, e) =>
+        {
+            e.ErrorContext.Handled = true;
+        },
     };
     };
 
 
     private Settings()
     private Settings()