Explorar o código

Added JsonIgnore to Border.Child; fixes unit test fail for config man

Tigger Kindel %!s(int64=2) %!d(string=hai) anos
pai
achega
2f8db4c9a0
Modificáronse 2 ficheiros con 6 adicións e 1 borrados
  1. 5 1
      Terminal.Gui/Configuration/Scope.cs
  2. 1 0
      Terminal.Gui/Core/Border.cs

+ 5 - 1
Terminal.Gui/Configuration/Scope.cs

@@ -129,7 +129,11 @@ namespace Terminal.Gui.Configuration {
 								}
 							}
 							var readHelper = Activator.CreateInstance ((Type?)typeof (ReadHelper<>).MakeGenericType (typeof (scopeT), propertyType!)!, converter) as ReadHelper;
-							scope! [propertyName].PropertyValue = readHelper?.Read (ref reader, propertyType!, options);
+							try {
+								scope! [propertyName].PropertyValue = readHelper?.Read (ref reader, propertyType!, options);
+							} catch (NotSupportedException e) {
+								throw new JsonException ($"Error reading property \"{propertyName}\" of type \"{propertyType.Name}\".", e);
+							}
 						} else {
 							scope! [propertyName].PropertyValue = JsonSerializer.Deserialize (ref reader, propertyType!, options);
 						}

+ 1 - 0
Terminal.Gui/Core/Border.cs

@@ -448,6 +448,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Gets or sets the single child element of a <see cref="View"/>.
 		/// </summary>
+		[JsonIgnore]
 		public View Child {
 			get => child;
 			set {