-Incremented version to 4.5.3
-Changed default DefaultContractResolver.IgnoreSerializableAttribute to true -Fixed MaxDepth on JsonReader recursively throwing error -Fixed SerializationBinder.BindToName not being called with full assembly names
This commit is contained in:
@@ -2282,6 +2282,65 @@ bye", reader.Value);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MaxDepthDoesNotRecursivelyError()
|
||||
{
|
||||
string json = "[[[[]]],[[]]]";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json))
|
||||
{
|
||||
MaxDepth = 1
|
||||
};
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(0, reader.Depth);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"The reader's MaxDepth of 1 has been exceeded. Line 1, position 2.",
|
||||
() =>
|
||||
{
|
||||
Assert.IsTrue(reader.Read());
|
||||
});
|
||||
Assert.AreEqual(1, reader.Depth);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(2, reader.Depth);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(3, reader.Depth);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(3, reader.Depth);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(2, reader.Depth);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(1, reader.Depth);
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
"The reader's MaxDepth of 1 has been exceeded. Line 1, position 9.",
|
||||
() =>
|
||||
{
|
||||
Assert.IsTrue(reader.Read());
|
||||
});
|
||||
Assert.AreEqual(1, reader.Depth);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(2, reader.Depth);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(2, reader.Depth);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(1, reader.Depth);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(0, reader.Depth);
|
||||
|
||||
Assert.IsFalse(reader.Read());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReadingFromSlowStream()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user