Skip to content

Question: Read a single message using System.IO.Pipelines #52180

Answered by Tornhoof
kiminuo asked this question in Q&A
Discussion options

You must be logged in to vote

Write only an empty buffer and complete the pipe:
something like:

pipeWriter.Write(ReadOnlySpan<byte>.Empty);
pipeWriter.Complete();

The TryParseMessage method will return false (not a complete message) and the pipe is Completed and the buffer.Length is 0, so no exception, that should hit the break

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by kiminuo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #52101 on May 03, 2021 05:43.