ebceu4 / protobuf-csharp-port

Automatically exported from code.google.com/p/protobuf-csharp-port
0 stars 0 forks source link

Circular message dependencies result in null defaults for DefaultInstance #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This issue was brought to light by the new reusable builders (issue-22) usage 
of DefaultInstance.  The following proto and test demonstrate the issue...

Proto:

    message MyMessageAReferenceB {
      required MyMessageBReferenceA value = 1;
    }

    message MyMessageBReferenceA {
      required MyMessageAReferenceB value = 1;
    }

Test: 

    MyMessageAReferenceB ab = MyMessageAReferenceB.DefaultInstance;
    Assert.IsNotNull(ab);
    Assert.IsNotNull(ab.Value);
    MyMessageBReferenceA ba = MyMessageBReferenceA.DefaultInstance;
    Assert.IsNotNull(ba);
    Assert.IsNotNull(ba.Value);  < EXCEPTION: ba.Value == null

Original issue reported on code.google.com by Grig...@gmail.com on 23 Sep 2011 at 2:30

GoogleCodeExporter commented 9 years ago
Please review the following change set:
http://code.google.com/p/protobuf-csharp-port/source/detail?r=9403ffdd6705d604f4
3a7a9a51a586dbe2745eb6&name=issue-28

Original comment by Grig...@gmail.com on 23 Sep 2011 at 4:21

GoogleCodeExporter commented 9 years ago

Original comment by Grig...@gmail.com on 28 Sep 2011 at 4:50