[ 
https://issues.apache.org/jira/browse/IGNITE-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15389364#comment-15389364
 ] 

Pavel Tupitsyn commented on IGNITE-3512:
----------------------------------------

Ctor call fixed, good point.

Yes, it should fit into IGNITE-2703, actually I've copied a piece of code from 
there.

> .NET: IBinaryObject.ToBuilder loses type name
> ---------------------------------------------
>
>                 Key: IGNITE-3512
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3512
>             Project: Ignite
>          Issue Type: Bug
>          Components: platforms
>    Affects Versions: 1.5.0.final
>            Reporter: Pavel Tupitsyn
>            Assignee: Pavel Tupitsyn
>             Fix For: 1.7
>
>
> 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:
> {code}
>         [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;
>             }
>         }
> {code}
> Workaround is to register the type by name on start:
> {code}
> BinaryConfiguration = new BinaryConfiguration
> {
>     Types = new[] {"myType"}
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to