Steps to reproduce:
- Create a builder for a string type name, set field, put to cache
- On another node, read this object, call ToBuilder, call Build
Type name is not propagated with metadata, which leads to assertion error (with -ea) or "Two binary types have duplicate type ID [typeId=949122880, typeName1=Security, typeName2=null]]" error.
Unit test:
[Test] public void Test() { using (var grid1 = Ignition.Start(TestUtils.GetTestConfiguration())) using (var grid2 = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration(false)) {GridName = "grid2"})) { var cache1 = grid1.CreateCache<int, int>("cache").WithKeepBinary<int, IBinaryObject>(); var obj1 = grid1.GetBinary().GetBuilder("myType").SetField("myField", "val").Build(); cache1[1] = obj1; var cache2 = grid2.GetCache<int, int>("cache").WithKeepBinary<int, IBinaryObject>(); var obj2 = cache2[1]; var val = obj2.GetField<string>("myField"); var obj2Ex = grid2.GetBinary().GetBuilder(obj2).SetField("myField", val + "_modified").Build(); cache2[2] = obj2Ex; } }
Workaround is to register the type by name on start:
BinaryConfiguration = new BinaryConfiguration { Types = new[] {"myType"} }
- blocks
-
IGNITE-3504 .NET: IBinaryObjectBuilder setter methods do not work
-
- Closed
-
- links to