Skip to content

Commit 628d99b

Browse files
authored
Properly map exceptions from NetworkStream ctor. (#39514)
1 parent 06700b4 commit 628d99b

File tree

1 file changed

+2
-2
lines changed
  • src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler

1 file changed

+2
-2
lines changed

src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ private static Stream Connect(string host, int port, CancellationToken cancellat
9696
{
9797
socket.Connect(new DnsEndPoint(host, port));
9898
}
99+
100+
return new NetworkStream(socket, ownsSocket: true);
99101
}
100102
catch (Exception e)
101103
{
102104
socket.Dispose();
103105
throw CreateWrappedException(e, host, port, cancellationToken);
104106
}
105-
106-
return new NetworkStream(socket, ownsSocket: true);
107107
}
108108

109109
/// <summary>SocketAsyncEventArgs that carries with it additional state for a Task builder and a CancellationToken.</summary>

0 commit comments

Comments
 (0)