From ac0eeb015a0266adb06696bb58c21e5bfe6d9b56 Mon Sep 17 00:00:00 2001 From: Ahmet Ibrahim Aksoy Date: Sat, 13 Jul 2024 09:16:54 +0200 Subject: [PATCH] [HTTP/3] Add null check in case we can't get H/3 inboundControlStream (#104797) * Add null check for inboundControlStream on Closing Path * Enable disabled H/3 test --- .../tests/System/Net/Http/Http3LoopbackConnection.cs | 7 +++++-- .../tests/FunctionalTests/DiagnosticsTests.cs | 6 ------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/libraries/Common/tests/System/Net/Http/Http3LoopbackConnection.cs b/src/libraries/Common/tests/System/Net/Http/Http3LoopbackConnection.cs index 581bc018a1983..a8e18ae6fce78 100644 --- a/src/libraries/Common/tests/System/Net/Http/Http3LoopbackConnection.cs +++ b/src/libraries/Common/tests/System/Net/Http/Http3LoopbackConnection.cs @@ -315,8 +315,11 @@ public async Task WaitForClientDisconnectAsync(bool refuseNewRequests = true) // The client's control stream should throw QuicConnectionAbortedException, indicating that it was // aborted because the connection was closed (and was not explicitly closed or aborted prior to the connection being closed) - QuicException ex = await Assert.ThrowsAsync(async () => await _inboundControlStream.ReadFrameAsync().ConfigureAwait(false)); - Assert.Equal(QuicError.ConnectionAborted, ex.QuicError); + if (_inboundControlStream is not null) + { + QuicException ex = await Assert.ThrowsAsync(async () => await _inboundControlStream.ReadFrameAsync().ConfigureAwait(false)); + Assert.Equal(QuicError.ConnectionAborted, ex.QuicError); + } await CloseAsync(H3_NO_ERROR).ConfigureAwait(false); } diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs index 8da624c76fd86..77b8893318343 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs @@ -237,12 +237,6 @@ await RemoteExecutor.Invoke(async (useVersion, testAsync) => [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public async Task SendAsync_ExpectedDiagnosticCancelledLogging() { - if (UseVersion == HttpVersion30) - { - // [ActiveIssue("https://github.com/dotnet/runtime/issues/104699")] - throw new SkipTestException("SendAsync_ExpectedDiagnosticCancelledLogging is broken on HTTP/3."); - } - await RemoteExecutor.Invoke(async (useVersion, testAsync) => { TaskCompletionSource responseLoggedTcs = new(TaskCreationOptions.RunContinuationsAsynchronously);