diff --git a/src/libraries/System.Net.Quic/src/Interop/MsQuicNativeMethods.cs b/src/libraries/System.Net.Quic/src/Interop/MsQuicNativeMethods.cs index 136051c228fd9..aca6b41a58006 100644 --- a/src/libraries/System.Net.Quic/src/Interop/MsQuicNativeMethods.cs +++ b/src/libraries/System.Net.Quic/src/Interop/MsQuicNativeMethods.cs @@ -304,15 +304,15 @@ internal struct StreamEventDataRecv internal ulong TotalBufferLength; internal QuicBuffer* Buffers; internal uint BufferCount; - internal byte Flags; + internal uint Flags; } [StructLayout(LayoutKind.Explicit)] internal struct StreamEventDataSendComplete { - [FieldOffset(7)] + [FieldOffset(0)] internal byte Canceled; - [FieldOffset(8)] + [FieldOffset(1)] internal IntPtr ClientContext; internal bool IsCanceled() @@ -336,7 +336,7 @@ internal struct StreamEventDataPeerRecvAbort [StructLayout(LayoutKind.Sequential)] internal struct StreamEventDataSendShutdownComplete { - internal bool Graceful; + internal byte Graceful; } [StructLayout(LayoutKind.Explicit)] diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs index 02a57c8790476..536968b55cdfd 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs @@ -101,6 +101,8 @@ internal override long StreamId { get { + ThrowIfDisposed(); + if (_streamId == -1) { _streamId = GetStreamId(); @@ -390,6 +392,8 @@ internal override ValueTask ShutdownWriteCompleted(CancellationToken cancellatio internal override void Shutdown() { + ThrowIfDisposed(); + MsQuicApi.Api.StreamShutdownDelegate(_ptr, (uint)QUIC_STREAM_SHUTDOWN_FLAG.GRACEFUL, errorCode: 0); } diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs index 2884f5e0a66ed..1a6531371190f 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs @@ -67,11 +67,10 @@ from writeSize in sizes select new object[] { readSize, writeSize }; } - [ActiveIssue("https://github.com/dotnet/runtime/issues/32049")] [Fact] public async Task Read_StreamAborted_Throws() { - const int ExpectedErrorCode = 1234; + const int ExpectedErrorCode = 0xfffffff; await Task.Run(async () => {