From 8511f5db43333633e0cfe2a62d3429f9e14f00cd Mon Sep 17 00:00:00 2001 From: Mitchell Sternke Date: Mon, 10 Oct 2016 17:14:24 -0700 Subject: [PATCH] Fixed issue where mac connections would not time out as expected (#81) * Fixed issue where mac connections would not time out as expected * Made check specific to OSX * Added check for linux --- .../Connection/ReliableConnection/RetryPolicyUtils.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Microsoft.SqlTools.ServiceLayer/Connection/ReliableConnection/RetryPolicyUtils.cs b/src/Microsoft.SqlTools.ServiceLayer/Connection/ReliableConnection/RetryPolicyUtils.cs index 800951d4..c8b86091 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Connection/ReliableConnection/RetryPolicyUtils.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Connection/ReliableConnection/RetryPolicyUtils.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Data.SqlClient; +using System.Runtime.InteropServices; using Microsoft.SqlTools.ServiceLayer.Utility; namespace Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection @@ -215,6 +216,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection public static bool IsRetryableNetworkConnectivityError(int errorNumber) { + // .NET core has a bug on OSX/Linux that makes this error number always zero (issue 12472) + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return errorNumber != 0 && _retryableNetworkConnectivityErrors.Contains(errorNumber); + } return _retryableNetworkConnectivityErrors.Contains(errorNumber); }