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); }