Skip to content

Read-only QuicStream throws inconsistent exceptions #121620

@PatrikTrefil

Description

@PatrikTrefil

Description

When we open a unidirectional stream and attempt to read from it, we get different exceptions for different read operations. ReadByte throws InvalidOperationException. CopyTo throws NotSupportedException.

Reproduction Steps

var outgoingStream = await connection.OpenOutboundStreamAsync(QuicStreamType.Unidirectional);
outgoingStream.ReadByte(); // throws InvalidOperationException
outgoingStream.CopyTo(new MemoryStream()); // throws NotSupportedException

Expected behavior

Both operations should throw the same exception.

Actual behavior

The operations throw different exceptions.

Regression?

Known Workarounds

Configuration

Not relevant.

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Net.QuicenhancementProduct code improvement that does NOT require public API changes/additions

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions