plutoo / protobuf-csharp-port

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

Descriptor namespace missing in generated code when handling import #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

When using the default namespace derived from the package the namespace is 
missing from the descriptor in the generated code. 

Repro steps:

Compile foo.proto with protogen.exe:
protogen.exe -output_directory=out\ -umbrella_classname=extensions 
-cls_compliance=false --error_format=msvs 
--proto_path=..\protobuf\protobuf-2.4.1\src --proto_path=. foo.proto 
--include_imports

Generates the following:

45      pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
46          new pbd::FileDescriptor[] {
47          global::foo.Descriptor,
48          }, assigner);

At line 47 it refers to global::foo.Descriptor where it should refer to 
global::bar.foo.Descriptor.

Workaround: Adding -namespace=bar on the command line generates the correct 
code in foo.cs

Original issue reported on code.google.com by e...@digitalsorcery.net on 26 Apr 2012 at 7:21

Attachments:

GoogleCodeExporter commented 9 years ago
Root cause seems to be the miss-handling of the -umbrella_classname=extensions 
argument.  Will look into this further as time permits.

Original comment by Grig...@gmail.com on 28 Sep 2012 at 12:32

GoogleCodeExporter commented 9 years ago

Original comment by Grig...@gmail.com on 11 Oct 2012 at 12:07

GoogleCodeExporter commented 9 years ago
The actual issue here is that the example provided needs to generate two source 
files, "foo.cs" and "extensions.cs".  However, the file name is derived from 
the  'umbrella_classname' not the base filename.  Due to this, both of the 
output files are written to the same file name, thus the later replacing the 
former.  

I've updated ProtoGen to detect collisions in file names, and if this occurs 
the base file name will be used to determine the generated output file rather 
than the umbrella name.

Original comment by Grig...@gmail.com on 7 May 2013 at 8:41