-Fixed error when deserializing ignored property with mismatched type

This commit is contained in:
James Newton-King
2015-11-28 18:13:10 +13:00
parent 425c1d8402
commit 226832ff5d
2 changed files with 314 additions and 22 deletions
@@ -262,6 +262,23 @@ namespace Newtonsoft.Json.Tests.Serialization
}, "Required property 'Bars' expects a value but got null. Path '', line 1, position 9.");
}
public class IgnoredProperty
{
[JsonIgnore]
[JsonProperty(Required = Required.Always)]
public string StringProp1 { get; set; }
[JsonIgnore]
public string StringProp2 { get; set; }
}
[Test]
public void NoErrorWhenValueDoesNotMatchIgnoredProperty()
{
IgnoredProperty p = JsonConvert.DeserializeObject<IgnoredProperty>("{'StringProp1':[1,2,3],'StringProp2':{}}");
Assert.IsNull(p.StringProp1);
Assert.IsNull(p.StringProp2);
}
public class Binding
{
[JsonProperty(Required = Required.Always)]
File diff suppressed because it is too large Load Diff