taohyson / protobuf-net

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

Enums referenced across files #99

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If you have a .proto that contains an enum, and a second proto that 
contains a message that imports the first proto and references the enum 
as "optional" and you use the detectMissing option, then the chsarp.xslt 
file generates incomplete C# code:

    public MyEnum my_val
    {
      get { return _my_val?? MyEnum.; }
      set { _my_val = value; }
    }

Notice the extra '.' at the end of the get?

The issue seems to be somewhere prior to the GetFirstEnumValue xsl 
template, as the "//EnumDescriptorProto" selector returns 0 nodes.

-------------------------------
File1:
enum MyEnum {
    TEST = 0;
    BLA = 1;
}
-------------------------------
File2:
import "file1.proto";

message MyMessage {
    optional MyEnum val = 0;
}
-------------------------------

now use protobuf-net to compile file1.proto.

Original issue reported on code.google.com by scoo...@gmail.com on 15 Mar 2010 at 8:52

GoogleCodeExporter commented 8 years ago

Original comment by marc.gravell on 16 Mar 2010 at 5:13