首页 > 解决方案 > Protobuf-net 反序列化异常数溢出

问题描述

在点网中反序列化 protobuf 数据时出现异常。我收到号码溢出异常。有什么方法可以让我得到哪个字段给出错误,因为原型结构非常大。

日志是这样的

09-12 12:55:50.318  9188  9507 E Unity   : Proto DEserialize exception : System.OverflowException: Number overflow.
09-12 12:55:50.318  9188  9507 E Unity   : at ProtoBuf.ProtoReader.TryReadUInt32VariantWithoutMoving (bool,uint&) <0x00328>
09-12 12:55:50.318  9188  9507 E Unity   : at ProtoBuf.ProtoReader.ReadUInt32Variant (bool) <0x0002f>
09-12 12:55:50.318  9188  9507 E Unity   : at ProtoBuf.ProtoReader.ReadInt32 () <0x00057>
09-12 12:55:50.318  9188  9507 E Unity   : at (wrapper dynamic-method) King.Data.GetUserdataInfoStruct.proto_2 (object,ProtoBuf.ProtoReader) <0x006c3>
09-12 12:55:50.318  9188  9507 E Unity   : at ProtoBuf.Serializers.CompiledSerializer.ProtoBuf.Serializers.IProtoSerializer.Read (object,ProtoBuf.ProtoReader) <0x00037>
09-12 12:55:50.318  9188  9507 E Unity   : at ProtoBuf.Meta.RuntimeTypeModel.Deserialize (int,object,ProtoBuf.ProtoReader) <0x00113>
09-12 12:55:50.318  9188  9507 E Unity   : at ProtoBuf.Meta.TypeModel.DeserializeCore (ProtoBuf.ProtoReader,System.Type,object,bool) <0x0006b>
09-12 12:55:50.318  9188  9507 E Unity   : at ProtoBuf.Meta.TypeModel.Deserialize (System.IO.Stream,object,System.Type,ProtoBuf.SerializationContext) <0x000a7>
09-12 12:55:50.318  9188  9507 E Unity   : at ProtoBuf.Meta.TypeModel.Deserialize (System.IO.Stream,object,System.Type) <0x0003b>
09-12 12:55:50.318  9188  9507 E Unity   : at ProtoBuf.Serializer.Deserialize<King.Data.GetUserdataInfoStruct> (System.IO.Stream) <0x00043>
09-12 12:55:50.318  9188  9507 E Unity   : at King.Proto.KingProtBufSerialize

标签: protobuf-net

解决方案


推荐阅读