isapego commented on a change in pull request #8724:
URL: https://github.com/apache/ignite/pull/8724#discussion_r566755571
##########
File path:
modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
##########
@@ -1645,18 +1645,37 @@ public void TestBinaryField()
IBinaryObject innerObject =
_marsh.Unmarshal<IBinaryObject>(dataInner, BinaryMode.ForceBinary);
BinaryObjectWrapper inner =
innerObject.Deserialize<BinaryObjectWrapper>();
-
+
Assert.NotNull(inner);
byte[] dataOuter = _marsh.Marshal(new BinaryObjectWrapper() { Val
= innerObject });
IBinaryObject outerObject =
_marsh.Unmarshal<IBinaryObject>(dataOuter, BinaryMode.ForceBinary);
BinaryObjectWrapper outer =
outerObject.Deserialize<BinaryObjectWrapper>();
-
+
Assert.NotNull(outer);
Assert.IsTrue(outer.Val.Equals(innerObject));
}
+ /// <summary>
+ /// Tests serializing/deserializing object lists with nested lists.
+ /// </summary>
+ [Test]
+ public void TestNestedLists()
+ {
+ var list = new[]
+ {
+ new NestedList {Inner = new List<object>()},
+ new NestedList {Inner = new List<object>()}
+ };
+
+ var bytes = _marsh.Marshal(list);
+ var res = _marsh.Unmarshal<NestedList[]>(bytes);
+
+ Assert.AreEqual(2, res.Length);
+ Assert.AreEqual(0, res[0].Inner.Count);
Review comment:
Let's check the second one as well?
##########
File path:
modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
##########
@@ -1084,7 +1084,7 @@ public static void WriteArray(Array val, BinaryWriter
ctx, int? elemTypeId = nul
stream.WriteInt(val.Length);
for (int i = 0; i < val.Length; i++)
- ctx.Write(val.GetValue(i));
+ ctx.WriteObjectDetached(val.GetValue(i), parentCollection:
val);
Review comment:
Don't you think that using `Write` instead of `WriteObjectDetached` is
very error-prone and sooner or later produce a hard-to-find errors? Are there
cases where `Write` really gives a good performance gain?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]