Closed XuLinFei closed 3 years ago
问题找到了,reader.TryReadTo(out ReadOnlySequence
try
{
if (!reader.TryReadTo(out ReadOnlySequence<byte> pack, terminatorSpan, advancePastDelimiter: false))
return null;
try
{
return DecodePackage(ref pack);
}
finally
{
reader.Advance(terminator.Length);
}
}
catch (Exception e)
{
reader.Rewind(reader.CurrentSpanIndex);
return null;
}
就可以了,希望可以官方修改一下这个bug
Please refer to https://github.com/dotnet/runtime/pull/276 What's the .net version you are using? .net core 3.0 or .net 5?
netcore 3.0
The bug was fixed in 3.1.3 according dotnet/runtime#276
好的,谢谢。
System.InvalidOperationException: End position was not reached during enumeration. at System.ThrowHelper.ThrowInvalidOperationException_EndPositionNotReached() at System.Buffers.SequenceReader
1.IsNextSlow(ReadOnlySpan
1 next, Boolean advancePast) at System.Buffers.SequenceReader1.TryReadTo(ReadOnlySequence
1& sequence, ReadOnlySpan1 delimiter, Boolean advancePastDelimiter) at SuperSocket.ProtoBase.TerminatorPipelineFilter
1.Filter(SequenceReader1& reader) at SuperSocket.Channel.PipeChannel
1.ReaderBuffer(ReadOnlySequence1& buffer, SequencePosition& consumed, SequencePosition& examined) at SuperSocket.Channel.PipeChannel
1.ReadPipeAsync(PipeReader reader)