zhejiushizhuce / protobuf-net

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

When a member of a message is named "value" the code generated with option detectMissing in C# is incorrect #161

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a message with an optional field named value
2. Build using protogen with "detectMissing" option to csharp sourcecode

What is the expected output? What do you see instead?

The ".cs" should build, instead if contains an invalid line (here for a double 
property) :

    set { if (value == (_value== null)) _value = value ? value : (double?)null; }

It should be :
    set { if (value == (_value== null)) _value = this.value ? value : (double?)null; }

What version of the product are you using? On what operating system?

v1 branch last released version.

Please provide any additional information below.

Patch attached.

Original issue reported on code.google.com by jroncagl...@gmail.com on 7 Mar 2011 at 4:46

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry, it should be :

    set { if (value == (_value== null)) _value = value ? this.value : (double?)null; }

(Patch is correct)

Original comment by jroncagl...@gmail.com on 7 Mar 2011 at 4:47

GoogleCodeExporter commented 9 years ago
Yes, good catch; I need to go through the xslt and clean up a few edge-cases

Original comment by marc.gravell on 7 Mar 2011 at 6:31