From 1f761f5434f00aeb50fc6cd53c34dbaee589acca Mon Sep 17 00:00:00 2001 From: Radek Zikmund <32671551+rzikm@users.noreply.github.com> Date: Tue, 23 Aug 2022 03:56:23 -0700 Subject: [PATCH] Remove assert from Http3Connection.SendAsync (#74348) * Remove assert in System.Net.Http.Http3Connection.SendAsync * Minor change --- .../System/Net/Http/SocketsHttpHandler/Http3Connection.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3Connection.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3Connection.cs index ee9732416a38d7..a431ee33cadbdb 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3Connection.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3Connection.cs @@ -240,7 +240,7 @@ public async Task SendAsync(HttpRequestMessage request, lon catch (QuicException ex) when (ex.QuicError == QuicError.OperationAborted) { // This will happen if we aborted _connection somewhere and we have pending OpenOutboundStreamAsync call. - Debug.Assert(_abortException is not null); + // note that _abortException may be null if we closed the connection in response to a GOAWAY frame throw new HttpRequestException(SR.net_http_client_execution_error, _abortException, RequestRetryType.RetryOnConnectionFailure); } finally @@ -567,6 +567,10 @@ private async Task ProcessServerStreamAsync(QuicStream stream) } } } + catch (QuicException ex) when (ex.QuicError == QuicError.OperationAborted) + { + // ignore the exception, we have already closed the connection + } catch (Exception ex) { Abort(ex);