Skip to content

Make StreamPipeReader.TryRead more usable #30161

Open
@halter73

Description

@halter73

Today the StreamPipeReader.TryRead (which overrides PipeReader.TryRead) either never returns any data (when ReadAsync is never called), or is likely to provide corrupted data (when ReadAsync is sometimes called).

The only way it's even a little bit useful today is if you've read data calling ReadAsync, partially advance, and already know data is available without any call to InnerStream.ReadAsync in the background. This is extremely limited though, and requires the consumer to know a lot about the implementation and limitations of the PipeWriter they are using.

See dotnet/corefx#39228 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.IO.PipelinesenhancementProduct code improvement that does NOT require public API changes/additions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions