Fix missing error when deserializing JToken with a contract type mismatch (#2494)
This commit is contained in:
@@ -3515,13 +3515,9 @@ Path '', line 1, position 1.");
|
||||
{
|
||||
string json = @"[]";
|
||||
|
||||
ExceptionAssert.Throws<InvalidCastException>(
|
||||
ExceptionAssert.Throws<JsonSerializationException>(
|
||||
() => { JsonConvert.DeserializeObject<JObject>(json); },
|
||||
new[]
|
||||
{
|
||||
"Unable to cast object of type 'Newtonsoft.Json.Linq.JArray' to type 'Newtonsoft.Json.Linq.JObject'.",
|
||||
"Cannot cast from source type to destination type." // mono
|
||||
});
|
||||
"Deserialized JSON type 'Newtonsoft.Json.Linq.JArray' is not compatible with expected type 'Newtonsoft.Json.Linq.JObject'. Path '', line 1, position 2.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user