-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:
James Newton-King
2012-04-14 00:58:36 +12:00
parent 11310fdf05
commit adecef2126
11 changed files with 151 additions and 9 deletions
@@ -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()
{