详细错误信息如下:
System.ArgumentOutOfRangeException: ArgRange_Array
Parameter name: count
at System.Text.UTF8Encoding.InternalGetCharCount (System.Byte[] bytes, Int32 index, Int32 count, UInt32 leftOverBits, UInt32 leftOverCount, System.Object provider, System.Text.DecoderFallbackBuffer& fallbackBuffer, System.Byte[]& bufferArg, Boolean flush) [0x00048] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/UTF8Encoding.cs:462
at System.Text.UTF8Encoding.GetCharCount (System.Byte[] bytes, Int32 index, Int32 count) [0x00004] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/UTF8Encoding.cs:687
at System.Text.Encoding.GetChars (System.Byte[] bytes, Int32 index, Int32 count) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/Encoding.cs:328
at System.Text.Encoding.GetString (System.Byte[] bytes, Int32 index, Int32 count) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/Encoding.cs:751
at System.Text.UTF8Encoding.GetString (System.Byte[] bytes, Int32 index, Int32 count) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/UTF8Encoding.cs:1052
at Message.AnaylsisMsg (Int32 size, System.Action`2 MessageCallback) [0x0005a] in D:\文档\自己写的\编程\unity3d\丛林战争\GameClient\Assets\Scripts\NetWork\Message.cs:47
at SocketManger.ReciveCaalbackFunc (IAsyncResult ar) [0x00042] in D:\文档\自己写的\编程\unity3d\丛林战争\GameClient\Assets\Scripts\Managers\SocketManager.cs:53
UnityEngine.Debug:Log(Object)
SocketManger:ReciveCaalbackFunc(IAsyncResult) (at Assets/Scripts/Managers/SocketManager.cs:61)
System.Net.Sockets.Worker:Receive()
经过逐步调试后,我发现运行过程中Message的StartIndex会先变成负数,然后越来越大直至超出buffer数据的长度,但我始终找不出原因,麻烦您帮我看一下,谢谢了。