somemdl / protobuf-net

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

Custom serializer works in debug - not in release #448

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Due to a bug in or system, I downloaded the source code and I added a new 
DataFormat called Unicode1Byte, which is a special StringSerializer.

In the switch-case for ProtoTypeCode.String in method 'TryGetCoreSerializer', I 
added support this new Unicode1Byte, which then returns this new 
StringSerializer.

case ProtoTypeCode.String:
  defaultWireType = WireType.String;
  if (dataFormat == DataFormat.Unicode1Byte)
  {
    return new StringUnicode1ByteSerializer(model);
  }

My special StringSerializer just calls methods in ProtoWriter and ProtoReader, 
as the normal StringSerializer does.

Now this works fine when running the application in debug, but in release, 
protobuf uses the standard string serializer, eventhough the special 
StringSerializer is returned in 'TryGetCoreSerializer'.

The protobuf version I'm using is r686

I tried to follow the code in debug, but gave up. Is this a bug in Protobuf-net 
due to some DEBUG defines ?

I can be reached on: eeybye@gmail.com

Original issue reported on code.google.com by eey...@gmail.com on 20 Jun 2014 at 2:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Forgot to correct the method names in EmitWrite and EmitRead. Now it works as 
supposed in RELEASE.

Original comment by eey...@gmail.com on 22 Jun 2014 at 6:46

GoogleCodeExporter commented 9 years ago
Sorry, I was away all weekend. From the last two additions, can I interpret 
that this is all done, and no input is needed from me here?

Original comment by marc.gravell on 23 Jun 2014 at 7:20

GoogleCodeExporter commented 9 years ago
Yes, no input is required from your side. Sorry for the inconvenience.

Original comment by eey...@gmail.com on 23 Jun 2014 at 7:24

GoogleCodeExporter commented 9 years ago

Original comment by marc.gravell on 23 Jun 2014 at 9:48