Closed xflag closed 5 years ago
As far as I understand, you tried to "decode" msgpack binary as ASCII string. So, AsciiEncoding
could change the bytes their value are greater than 0x7F. So, variable s
might be corrupted.
As far as I understand, you tried to "decode" msgpack binary as ASCII string. So,
AsciiEncoding
could change the bytes their value are greater than 0x7F. So, variables
might be corrupted.
en,how "decode" msgpack binary as string successfully?
using (var stream1 = new MemoryStream()) { SerializationContext ctx = new SerializationContext() { SerializationMethod = SerializationMethod.Map }; var serializer1 = MessagePackSerializer.Get<P>(ctx); serializer1.Pack(stream1, new P() { Name = "Nesta",Team="Lazio" }); stream1.Position = 0; var p1 = serializer1.Unpack(stream1); byte[] b = stream1.ToArray(); MemoryStream stream = new MemoryStream(b); stream.Position = 0; var p2 = serializer1.Unpack(stream); }
I solve this problem,set byte[] to redis,don't convert to string.Tks.
above code,p1 has correct value,but p2's property is null.Why?