This project is read-only.


ObjectUtilities.SerializeObjectToBinary(object o) is returning wrong buffer.


The ObjectUtilities.SerializeObjectToBinary(object o) function is returning the buffer obtained via MemoryStream.GetBuffer() which is an internal buffer maintained by MemoryStream and is not supported to hold the exact serialized bytes (will contain extra bytes at the end). The fix would be to use MemoryStream.ToArray() function.
The issue can be confirmed by comparing the return byte[] of GetBuffer() and ToArray() functions. The former would be bigger than the latter as it would contain unused space at the end.
The current implementation might still work in most of the cases, but it is not the right thing by principle.


schizoidboy wrote Oct 10, 2007 at 1:24 PM

Hi, thank you very much for this fix, I will put it in the next release.


schizoidboy wrote Oct 10, 2007 at 3:12 PM

Hi, this has been fixed in release


I notice that this change causes the byte array to be copied, but that is better than non-deterministic behavior.


wrote Oct 10, 2007 at 3:12 PM

wrote Feb 14, 2013 at 2:55 AM

wrote May 16, 2013 at 7:58 AM

wrote May 16, 2013 at 7:58 AM

wrote Jun 14, 2013 at 7:47 AM