4

I am trying to implement messagepack lib in my project to serialize and deserialize the POCO objects to be store in Redis however getting below exception:

MessagePackDynamicObjectResolverException: can't find matched constructor. type:System.String

---------------------------------- helper library ------------------------

public static class MsgPackSerializer
    {
        //TODO we can add other Resolver if needed
        private static readonly MessagePackSerializerOptions options = MessagePackSerializerOptions.Standard.WithResolver(
                CompositeResolver.Create(
                    //ImmutableCollectionResolver.Instance,
                    DynamicGenericResolver.Instance,
                    PrimitiveObjectResolver.Instance,
                    DynamicContractlessObjectResolver.Instance,
                    DynamicContractlessObjectResolverAllowPrivate.Instance,
                    ContractlessStandardResolver.Instance,
                    ContractlessStandardResolverAllowPrivate.Instance
                   )).WithCompression(MessagePackCompression.Lz4BlockArray);

        public static byte[] Serialize<T>(T objValue)
        {
            return MessagePackSerializer.Serialize<T>(objValue, options);
        }
        public static T Deserialize<T>(byte[] byteArray)
        {
            return MessagePackSerializer.Deserialize<T>(byteArray, options);
        }
    }

Any help would be appreciated.

Amit Singh
  • 71
  • 1
  • 6

0 Answers0