anerjan / protobuf-net

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

Default value for enumeration isn't correctly computed with no package #160

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a .proto without a package line
2. Add an enum
3. Add a message using that enum as an optional member without default value 
explicitly defined.
4. Compile to .cs

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

Expected the default value to show up as it is the case when there is a package 
defined but instead of "MyEnum.MY_MEMBER" got "MyEnum.".

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

"NET3" from "protobuf-net r282.zip" on Windows 7 x64. 

Please provide any additional information below.

Bug is in GetFirstEnumValue in csharp.xslt it search for 
"ancestor::FileDescriptorProto" but should instead search for 
"ancestor::FileDescriptorProto[package]"

Original issue reported on code.google.com by jroncagl...@gmail.com on 3 Mar 2011 at 2:27

GoogleCodeExporter commented 9 years ago
For me it happens even when package is specified.

Original comment by filip.fr...@debesys.net on 27 Jul 2012 at 6:18

GoogleCodeExporter commented 9 years ago
I have a lot of protogen/xslt maintenance coming up soon on the roadmap - will 
look at this then

Original comment by marc.gravell on 27 Jul 2012 at 8:13

GoogleCodeExporter commented 9 years ago
Thanks in advance. Right now I result to generating and fixing C# files by 
hand. Would be nice if the process was fully automated.
BTW - maybe instead of "VS custom tool" there should be an MSBuild task?

Original comment by filip.fr...@debesys.net on 27 Jul 2012 at 7:06

GoogleCodeExporter commented 9 years ago
I will investigate what that takes to integrate. The nice thing about custom 
tools is that the IDE takes care of them.

Original comment by marc.gravell on 27 Jul 2012 at 7:44