Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-3512

.NET: IBinaryObject.ToBuilder loses type name

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.0.final
    • Fix Version/s: 1.7
    • Component/s: platforms
    • Labels:
      None

      Description

      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"}
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vozerov Vladimir Ozerov
                Reporter:
                ptupitsyn Pavel Tupitsyn
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: