pizheng / protobuf-net

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

Boolean members with false value not serialized. Looks like an optimization done on serialization #199

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please include an e-mail address if this might need a dialogue!
praveen.bhushan@rbccm.com
==============

What steps will reproduce the problem?
1. Declare 2 bool fields
2. Set one of them as true
3. Serialize it

What is the expected output? What do you see instead?
Expected output is to get both the members serialized with one as true & other 
as false.  
Only the true fields are serialized. 

If I deserialize it with protobuf-net it deserializes correctly as it might 
have been taken care of. But on the other side we have a different protocol 
buffer implementation which does not automatically handles it.

What version of the product are you using? On what operating system?
V 1 1.0.0.275 Windows XP Professional

Please provide any additional information below.
I have searched the existing issues & could not find it. 

Original issue reported on code.google.com by praveen....@gmail.com on 29 Jun 2011 at 4:56

GoogleCodeExporter commented 9 years ago
Yes, a design choice I regret. You can fix this my marking the member as 
required (an option on the ProtoMember or DataMember). I might well add a 
global switch for this is v2, allowing for v1 behaviour (implicit defaults), 
but defaulting to: Not

Original comment by marc.gravell on 29 Jun 2011 at 5:18

GoogleCodeExporter commented 9 years ago
Thanks for your comments. A global switch would be perfect.

Original comment by praveen....@gmail.com on 29 Jun 2011 at 5:57

GoogleCodeExporter commented 9 years ago
Well for v2 it be nice for us to have such an option (if we ever switch that is)

We use protobuf-net to minimize traffic when using WCF (and to enforce a 
certain strictness), so we'd prefer the v1 behavior.

Original comment by tim@mylemans.com on 4 Jul 2011 at 8:20

GoogleCodeExporter commented 9 years ago

Original comment by marc.gravell on 12 Jul 2011 at 7:33

GoogleCodeExporter commented 9 years ago
Added, as UseImplicitZeroDefaults on RuntimeTypeModel

Original comment by marc.gravell on 12 Jul 2011 at 8:25