-
Hi .NET Team, I'm puzzled a bit byt the sample provided here https://docs.microsoft.com/en-us/dotnet/standard/io/pipelines#read-a-single-message. I wonder about this part: // There's no more data to be processed.
if (result.IsCompleted)
{
if (buffer.Length > 0)
{
// The message is incomplete and there's no more data to process.
throw new InvalidDataException("Incomplete message.");
}
break;
} Specifically, I'm curious when the Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Beta Was this translation helpful? Give feedback.
-
Write only an empty buffer and complete the pipe: pipeWriter.Write(ReadOnlySpan<byte>.Empty);
pipeWriter.Complete(); The |
Beta Was this translation helpful? Give feedback.
Write only an empty buffer and complete the pipe:
something like:
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