MsgPack with Autoquery

Hello,
I’m transferring a large amount of data to C# client app and experimenting with MsgPack format.
It seems that MsgPack format has a problem serializing QueryResponse.

Example DTO:

[Route("/products", "GET")]
public class QueryProducts: QueryDb<ProductDb>, IHasNullableId, IGet
{
    public long? Id { get; set; }
}

Exception messages:

Internal Server Error
Cannot deserialize member 'Offset' of type 'System.Int32'.
Inner exception message: Cannot convert 'System.Int32' type value from type 'FixedArray'(0x96) in position 2.

Stack trace:

at MsgPack.MessagePackStreamUnpacker.ThrowTypeException(Type type, ReadValueResult header) 
at MsgPack.MessagePackStreamUnpacker.ReadInt32Slow(ReadValueResult header, Byte[] buffer, Int64& offset, Int32& result) 
at MsgPack.MessagePackStreamUnpacker.ReadInt32(Int32& result) at MsgPack.Serialization.UnpackHelpers.UnpackInt32Value(Unpacker unpacker, Type objectType, String memberName)

Could be an issue with the generic response DTO. We’ve only got control over our own serializer implementations. For a binary serializer try, protobuf-net which is better supported.

You’ll need to make sure all your DTOs have [DataContract] and all its properties annotated with an index, e.g. [DataMember(Order=...)].

Yes, I was trying to avoid adding [DataMember] and [DataContract] attributes to all my DTOs.
Maybe I will try to see how much performance will this add.
Thank you

I was also experimentig with spliting large amount of data (List with ~1M records) into multiple asynchronous requests (20 request with ~50K records) and combine them on client side.
It seems that this is working fine and adds much performance benefits. Do you think that this can cause any problems in production?

You may have issues with the browser retaining that much data in memory.

WinForms application is handling this amount of data fine.
If you don’t see any problems with .net core ServiceStack server application than all is OK.
Thank you.

1 Like