CMertens / protobuf-net

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

Invalid proto data with TimeSpan via GetSchema() #445

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a C# class:
  [ProtoContract]
  public class Test {
    [ProtoMember(1)]
    public TimeSpan value;
  }

2. Generate a proto file with GetSchema():
  var schema = ProtoBuf.Meta.RuntimeTypeModel.Default.GetSchema(typeof(Test));
  File.WriteAllText( "test.proto", schema );

  /* Outputs:
  import "bcl.proto"; // schema for protobuf-net's handling of core .NET types

  message BlackJackPrizeDetails {
     optional bcl.TimeSpan value = 1 [default = 00:00:00];
  }
  */

3. Try to compile with protoc:
  protoc -o test.desc test.proto

  test.proto:4:47: Expected identifier.

What is the expected output? What do you see instead?
  I expect to get a compilable proto file.

What version of the product are you using? On what operating system?
  protobuf-net: r668
  protoc: 2.5.0

  ran via Mono on OSX

Original issue reported on code.google.com by e.laberg...@gmail.com on 30 May 2014 at 12:56

GoogleCodeExporter commented 9 years ago
Hmmm, yes, that default value is nonsense; my bad

Original comment by marc.gravell on 30 May 2014 at 1:02