tenemos algunos problemas con la serialización de una lista vacía. aquí algo de código en .NET CF usando 2,0protobuf-net: serializar una lista vacía
//Generating the protobuf-msg
ProtoBufMessage msg = new ProtoBufMessage();
msg.list = new List<AnotherProtobufMessage>();
// Serializing and sending throw HTTP-POST
MemoryStream stream = new MemoryStream();
Serializer.Serialize(stream, msg);
byte[] bytes = stream.ToArray();
HttpWebRequest request = createRequest();
request.ContentLength = bytes.Length ;
using (Stream httpStream = request.GetRequestStream())
{
httpStream.Write(bytes, 0, bytes.Length);
}
conseguimos una excepción, cuando tratamos de escribir en la corriente (bytes.length fuera de rango). Pero un tipo con una lista vacía no debe tener 0 bytes, a la derecha (¿tipo de información?)?
Necesitamos este tipo de envío, porque en la respuesta están los mensajes del servidor para nuestro cliente.