You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Is it a bug? Or it is not possible to apply a patch to changed json?
I created a patch on 'a' object, then cleared array of 'a' and tried to apply that patch
but got following error:
[Test]
public void test()
{
var a = new Foo { A = new[] { 1 } };
var b = new Foo { A = new int[0] };
var jsonA = JsonConvert.SerializeObject(a);
var jsonB = JsonConvert.SerializeObject(b);
var jdp = new JsonDiffPatch();
var diff = jdp.Diff(jsonA, jsonB);
/////
a.A = new int[0];
jsonA = JsonConvert.SerializeObject(a);
Console.WriteLine(jdp.Patch(jsonA, diff));
}
private class Foo
{
public int[] A { get; set; }
}
System.ArgumentOutOfRangeException : Index is equal to or greater than Count.
Parameter name: index
at Newtonsoft.Json.Linq.JContainer.RemoveItemAt(Int32 index)
at JsonDiffPatchDotNet.JsonDiffPatch.ArrayPatch(JArray left, JObject patch)
at JsonDiffPatchDotNet.JsonDiffPatch.Patch(JToken left, JToken patch)
at JsonDiffPatchDotNet.JsonDiffPatch.ObjectPatch(JObject obj, JObject patch)
at JsonDiffPatchDotNet.JsonDiffPatch.Patch(JToken left, JToken patch)
at JsonDiffPatchDotNet.JsonDiffPatch.Patch(String left, String patch)
at jtest.test() in jtest.cs:line 29
The text was updated successfully, but these errors were encountered:
Hi! Is it a bug? Or it is not possible to apply a patch to changed json?
I created a patch on 'a' object, then cleared array of 'a' and tried to apply that patch
but got following error:
The text was updated successfully, but these errors were encountered: