anerjan / protobuf-net

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

Protogen generates uncompilable C# class with enum and fixCase option. #224

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please include an e-mail address if this might need a dialogue!
==============

What steps will reproduce the problem?
1. Create a simple definition:
      package ProtobufTest;
      enum CallType { INCOMING_VOICE_CALL = 1; }
      message GcmdRecord { optional CallType call_type = 1; }
2. Compile the definition using the 'fixCase' option.
3. Examine the generated C# class and enum definitions.

What is the expected output? What do you see instead?
Expected to get a C# source file that is compilable without errors.
Instead, the source code tries to initialise the private member variable of 
type CallType with the un-fixed enum name.  A similar problem exists with the 
DefaultValue attribute content.

Got this:
    private ProtobufTest.CallType _callType = ProtobufTest.CallType.INCOMING_VOICE_CALL;

Should have got this:
    private ProtobufTest.CallType _callType = ProtobufTest.CallType.INCOMINGVOICECALL;

Got this:
[global::System.ComponentModel.DefaultValue(ProtobufTest.CallType.INCOMING_VOICE
_CALL)]

Should have got this:
[global::System.ComponentModel.DefaultValue(ProtobufTest.CallType.INCOMINGVOICEC
ALL)]

What version of the product are you using? On what operating system?
Protogen.exe 1.0.0.280 from the Visual Studio 2010 integration MSI.
64-bit Windows 7

Please provide any additional information below.

Its already been noted in another issue that the Protogen 'fixCase' option does 
not work correctly on an enum definition that uses upper case characters and 
underscores when defining the values.  In this issue the option simply removes 
the underscores, leaving the fixed name all upper-case.

The issue above represents another problem with the 'fixCase' option.

Email: raz at jump-jet dot demon dot co dot uk

Original issue reported on code.google.com by r...@jump-jet.demon.co.uk on 30 Aug 2011 at 2:11

GoogleCodeExporter commented 9 years ago
This is a duplicate of issue #142 which I've just found.

Original comment by r...@jump-jet.demon.co.uk on 30 Aug 2011 at 2:45