Search code examples
silverlightwcf-ria-servicesprotocol-buffersprotobuf-net

deserializing with protobuf.net over ria services


I am having problems with de-serializing a collection of objects with ProtoBuf.net. It correctly serializes it in the byte array and I am passing that byte array from a WCF Ria service to Silverlight which is trying to deserialize the results.

I am serializing using Serializer.Serialize<T>(...) / Serializer.Deserialize<T>(...), and sending the byte[] (via MemoryStream) via WCF RIA.

When trying to deserialize in Silverlight, it gives the error:

Invalid callback signature in ComplexObject.OnDeserializing


Solution

  • This is what we technically call a "bug", that impacts serialization callbacks with a SerializationContext parameter, but only on specific platforms. Basically, a bit of code was the wrong side of a #if (to cut binary-formatter related code out of the Silverlight etc builds).

    The tests for this have been straightened out, and this is fixed in r431. I've also improved the error message to give a more useful message, including method name (code that already existed elsewhere, but not used from there oddly).

    Let me know you need a new zip archive for that (vs build from source).

    Annoyingly, the actual "doing" code would have been fine - it was only that sanity-check that was... not sane.