title: protobuf-net - problem with deserializing on C++ side :(
body: <p>I am using ProtoBuf-Net in my .NET application to serialize the following : (in .proto format)</p>
  
  <pre><code>message ProtoScreenBuffer {
  optional int32 MediaId = 1;
  optional bytes Data = 2;
  optional bool LastBuffer = 3;
  optional int64 StartTime = 4;
  optional int64 StopTime = 5;
  optional int32 Flags = 6;
  optional int32 BufferSubType = 7;
  optional int32 BufferType = 8;
  optional Guid Guid = 9;
  repeated int32 EncryptedDataStart = 10;
  repeated int32 EncryptedDataLength = 11;
  }
  </code></pre>
  
  <p>My aim is to serialize this and inject it into an ASF file, as a single sample.</p>
  
  <p>I call this to serialize :   </p>
  
  <pre><code>MemoryStream ms = new MemoryStream();
  Serializer.Serialize&lt;ProtoScreenBuffer&gt;(ms, ProtoScreenBuffer.CreateProtoScreenBuffer (buffer));
  </code></pre>
  
  <p>then I get a byte array from the ms object : </p>
  
  <pre><code>ms.ToArray();
  </code></pre>
  
  <p>and I put this byte array in the ASF.  The big problem is on my C++ app which reads the ASF sample just fine, I get a memory access violation when I try to deserialize it :(</p>
  
  <p>this is my C++ code :   </p>
  
  <pre><code>m_screenBuffer.ParseFromArray(serBuffer, dwInputDataLen); 
  </code></pre>
  
  <p>(where m_screenBuffer is ProtoScreenBuffer, serBuffer is the raw byte array I got from the ASF file, and dwInputDataLen is the length of it.)</p>
  
  <p>Are any of the things I'm doing here wrong , for what I'm trying to do (serialize in C# .NET and deserialize in C++?)</p>
  
  <p>Thanks alot.</p>
  
  <p>Roey</p>