Fix MaxDepth when used with ToObject inside of a JsonConverter (#2505)
This commit is contained in:
@@ -36,6 +36,7 @@ using System.Runtime.Serialization.Json;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if DNXCORE50
|
||||
using Xunit;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
@@ -306,6 +307,21 @@ namespace Newtonsoft.Json.Tests
|
||||
{
|
||||
return @"@""" + json.Replace(@"""", @"""""") + @"""";
|
||||
}
|
||||
|
||||
protected string GetNestedJson(int depth)
|
||||
{
|
||||
JObject root = new JObject();
|
||||
JObject current = root;
|
||||
for (int i = 0; i < depth - 1; i++)
|
||||
{
|
||||
JObject nested = new JObject();
|
||||
current[i.ToString()] = nested;
|
||||
|
||||
current = nested;
|
||||
}
|
||||
|
||||
return root.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public static class CustomAssert
|
||||
|
||||
Reference in New Issue
Block a user