-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-System.IO.Pipelinestenet-reliabilityReliability/stability related issue (stress, load problems, etc.)Reliability/stability related issue (stress, load problems, etc.)
Milestone
Description
I just noticed that segments in a ReadResult can be empty:

I assumed that the first segment was never empty, so I often use result.Buffer.First.Span[0]; to access the first byte.
Is this intended behaviour? Can this be caused by me writing to the pipe in a wrong way? This is how I fill my pipe from a System.IO.Compression.DeflateStream:
private async Task Decompress(PipeWriter writer, ReadOnlyMemory<byte> data, int count)
{
InflateInputStream.Position = 0;
InflateInputStream.Write(data.Span.Slice(0, count));
InflateInputStream.Position = 0;
InflateInputStream.SetLength(count);
int read;
do
{
Memory<byte> memory = writer.GetMemory(data.Length * 2);
read = InflateOutputStream.Read(memory.Span);
writer.Advance(read);
}
while (read != 0);
await writer.FlushAsync();
}freddyrios
Metadata
Metadata
Assignees
Labels
area-System.IO.Pipelinestenet-reliabilityReliability/stability related issue (stress, load problems, etc.)Reliability/stability related issue (stress, load problems, etc.)