--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
You can repro this with a trivial example with a byte[] as an initialized member field. In my particular case, it was storing some XML describing the layout of the window class (AvalonDock.DockingManager.SaveLayout/RestoreLayout), and the bug was duplicating the XML. This subsequently caused the XmlDocument to throw an exception as there were 2 roots to the xml tree. I fixed it by altering BlobSerializer.RequiresOldValue to return false.
Now you mention it, I see why you might want to append to the array, as part of the “append to the existing items”/Merge feature. Might be useful to have an attribute to set this append behaviour per member.
Cheers,
Richard
You can repro this with a trivial example with a byte[] as an initialized member field. In my particular case, it was storing some XML describing the layout of the window class (AvalonDock.DockingManager.SaveLayout/RestoreLayout), and the bug was duplicating the XML. This subsequently caused the XmlDocument to throw an exception as there were 2 roots to the xml tree. I fixed it by altering BlobSerializer.RequiresOldValue to return false.
Now you mention it, I see it’s part of the “append to the list of existing items”/Merge feature. Might be useful to have an attribute to set this append behaviour per field.
Cheers,
Richard
From: Marc Gravell [mailto:marc.g...@gmail.com]
Sent: 31 January 2011 01:04
To: NYCBrit
Cc: Protocol Buffers
Subject: Re: [protobuf] Why does protobuf-net append to a byte[] Property/field on deserialize?
Hmmm - good question. A bit of an edge case, really, deserializing over the top of an existing byte[], or having duplicated byte[]. But thinking about it, it probably should adhere to the "singular scalar fields" logic and replace rather than accumulate.