diff --git a/src/Testing/src/HttpClientSlim.cs b/src/Testing/src/HttpClientSlim.cs index 5e301bc29d42..deae7aaff7a7 100644 --- a/src/Testing/src/HttpClientSlim.cs +++ b/src/Testing/src/HttpClientSlim.cs @@ -108,11 +108,7 @@ private static async Task ReadResponse(Stream stream) private static async Task RetryRequest(Func> retryBlock) { - var retryCount = 1; - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - retryCount = 3; - } + var retryCount = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 1 : 3; for (var retry = 0; retry < retryCount; retry++) { @@ -190,7 +186,12 @@ public static async Task GetSocket(Uri requestUri) if (socket == null) { +#if NETCOREAPP + // Include the host and port explicitly in case there's a parsing issue + throw new SocketException((int)socketArgs.SocketError, $"Failed to connect to server {requestUri.Host} on port {requestUri.Port}"); +#else throw new SocketException((int)socketArgs.SocketError); +#endif } else {