diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj index ff1672c097..f4f09ef5ea 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -310,6 +310,14 @@ Microsoft\Data\SqlClient\Reliability\SqlConfigurableRetryLogicManager.cs + + Microsoft\Data\SqlClient\Reliability\SqlConfigurableRetryLogicLoader.cs + + + Microsoft\Data\SqlClient\Reliability\AppConfigManager.cs + + + Microsoft\Data\SqlClient\SqlUtil.cs @@ -334,7 +342,6 @@ - @@ -383,14 +390,6 @@ - - Microsoft\Data\SqlClient\Reliability\SqlConfigurableRetryLogicManager.CreateProvider.NetCoreApp.cs - - - Microsoft\Data\SqlClient\Reliability\AppConfigManager.NetCoreApp.cs - - - @@ -838,7 +837,7 @@ - + @@ -857,6 +856,7 @@ + diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicManager.NetStandard.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicManager.NetStandard.cs deleted file mode 100644 index 7d01bf7713..0000000000 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicManager.NetStandard.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Data.SqlClient -{ - /// - /// Configurable retry logic manager; - /// Receive the default providers by a loader and feeds the connections and commands. - /// - internal sealed partial class SqlConfigurableRetryLogicManager - { - private static readonly Lazy s_loader = - new Lazy(() => new SqlConfigurableRetryLogicLoader()); - } - /// - /// Configurable retry logic loader - /// - internal sealed partial class SqlConfigurableRetryLogicLoader - { - public SqlConfigurableRetryLogicLoader() - { - AssignProviders(); - } - } -} diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Reliability/SqlAppContextSwitchManager.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAppContextSwitchManager.NetCoreApp.cs similarity index 100% rename from src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Reliability/SqlAppContextSwitchManager.NetCoreApp.cs rename to src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAppContextSwitchManager.NetCoreApp.cs diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs index e4b71d6eb2..24a82db701 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs @@ -493,20 +493,7 @@ private SqlInternalConnectionTds InternalTdsConnection } } - private bool? _isRetryEnabled; - private bool IsRetryEnabled - { - get - { - if (_isRetryEnabled == null) - { - bool result; - result = AppContext.TryGetSwitch(SqlRetryLogicProvider.EnableRetryLogicSwitch, out result) ? result : false; - _isRetryEnabled = result; - } - return (bool)_isRetryEnabled; - } - } + private static bool IsRetryEnabled => LocalAppContextSwitches.IsRetryEnabled; /// public SqlRetryLogicBaseProvider RetryLogicProvider diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs index 5ce75ba598..6bdc8cf6f9 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs @@ -111,20 +111,7 @@ private static readonly ConcurrentDictionary> _ColumnEncry private static readonly Action s_openAsyncCancel = OpenAsyncCancel; private static readonly Action, object> s_openAsyncComplete = OpenAsyncComplete; - private bool? _isRetryEnabled; - private bool IsRetryEnabled - { - get - { - if (_isRetryEnabled == null) - { - bool result; - result = AppContext.TryGetSwitch(SqlRetryLogicProvider.EnableRetryLogicSwitch, out result) ? result : false; - _isRetryEnabled = result; - } - return (bool)_isRetryEnabled; - } - } + private static bool IsRetryEnabled => LocalAppContextSwitches.IsRetryEnabled; /// public SqlRetryLogicBaseProvider RetryLogicProvider diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index a0bf1d5a51..61cc77db4f 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -401,8 +401,8 @@ Microsoft\Data\SqlClient\Reliability\SqlConfigurableRetryLogicManager.cs - - Microsoft\Data\SqlClient\Reliability\SqlConfigurableRetryLogicManager.CreateProvider.cs + + Microsoft\Data\SqlClient\Reliability\SqlConfigurableRetryLogicLoader.cs Microsoft\Data\SqlClient\Reliability\AppConfigManager.cs diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs index bb0264666f..b0f8dc3d50 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs @@ -616,20 +616,7 @@ private bool IsShiloh } } - private bool? _isRetryEnabled; - private bool IsRetryEnabled - { - get - { - if (_isRetryEnabled == null) - { - bool result; - result = AppContext.TryGetSwitch(SqlRetryLogicProvider.EnableRetryLogicSwitch, out result) ? result : false; - _isRetryEnabled = result; - } - return (bool)_isRetryEnabled; - } - } + private static bool IsRetryEnabled => LocalAppContextSwitches.IsRetryEnabled; /// [ diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs index ef0d91934e..af4b1a3fcf 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlConnection.cs @@ -310,20 +310,7 @@ internal List GetColumnEncryptionCustomKeyStoreProvidersNames() // Retry Logic private SqlRetryLogicBaseProvider _retryLogicProvider; - private bool? _isRetryEnabled; - private bool IsRetryEnabled - { - get - { - if (_isRetryEnabled == null) - { - bool result; - result = AppContext.TryGetSwitch(SqlRetryLogicProvider.EnableRetryLogicSwitch, out result) ? result : false; - _isRetryEnabled = result; - } - return (bool)_isRetryEnabled; - } - } + private static bool IsRetryEnabled => LocalAppContextSwitches.IsRetryEnabled; /// [ diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs index 14084f92b0..9d2111ac24 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs @@ -3,17 +3,52 @@ // See the LICENSE file in the project root for more information. using System; +using System.Reflection; using System.Runtime.CompilerServices; namespace Microsoft.Data.SqlClient { internal static partial class LocalAppContextSwitches { + private const string TypeName = nameof(LocalAppContextSwitches); internal const string MakeReadAsyncBlockingString = @"Switch.Microsoft.Data.SqlClient.MakeReadAsyncBlocking"; internal const string LegacyRowVersionNullString = @"Switch.Microsoft.Data.SqlClient.LegacyRowVersionNullBehavior"; + // safety switch + internal const string EnableRetryLogicSwitch = "Switch.Microsoft.Data.SqlClient.EnableRetryLogic"; private static bool _makeReadAsyncBlocking; private static bool? s_LegacyRowVersionNullBehavior; + private static bool? s_isRetryEnabled = null; + +#if !NETFRAMEWORK + static LocalAppContextSwitches() + { + IAppContextSwitchOverridesSection appContextSwitch = AppConfigManager.FetchConfigurationSection(AppContextSwitchOverridesSection.Name); + try + { + SqlAppContextSwitchManager.ApplyContextSwitches(appContextSwitch); + } + catch (Exception e) + { + // Don't throw an exception for an invalid config file + SqlClientEventSource.Log.TryTraceEvent(": {2}", TypeName, MethodBase.GetCurrentMethod().Name, e); + } + } +#endif + + internal static bool IsRetryEnabled + { + get + { + if (s_isRetryEnabled is null) + { + bool result; + result = AppContext.TryGetSwitch(EnableRetryLogicSwitch, out result) ? result : false; + s_isRetryEnabled = result; + } + return s_isRetryEnabled.Value; + } + } public static bool MakeReadAsyncBlocking { @@ -33,7 +68,7 @@ public static bool LegacyRowVersionNullBehavior { get { - if (s_LegacyRowVersionNullBehavior == null) + if (s_LegacyRowVersionNullBehavior is null) { bool value = false; if (AppContext.TryGetSwitch(LegacyRowVersionNullString, out bool providedValue)) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/Common/SqlRetryLogicProvider.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/Common/SqlRetryLogicProvider.cs index cee9b4a24d..c865c2870c 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/Common/SqlRetryLogicProvider.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/Common/SqlRetryLogicProvider.cs @@ -19,9 +19,6 @@ internal class SqlRetryLogicProvider : SqlRetryLogicBaseProvider // keeps free RetryLogic objects private readonly ConcurrentBag _retryLogicPool = new ConcurrentBag(); - // safety switch for the preview version - internal const string EnableRetryLogicSwitch = "Switch.Microsoft.Data.SqlClient.EnableRetryLogic"; - /// Creates an instance of this type. public SqlRetryLogicProvider(SqlRetryLogicBase retryLogic) { diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicManager.CreateProvider.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicLoader.cs similarity index 90% rename from src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicManager.CreateProvider.cs rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicLoader.cs index f37d3ef3d5..838dd9f9da 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicManager.CreateProvider.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicLoader.cs @@ -9,37 +9,6 @@ namespace Microsoft.Data.SqlClient { - /// - /// Configurable retry logic manager; - /// Receive the default providers by a loader and feeds the connections and commands. - /// - internal sealed partial class SqlConfigurableRetryLogicManager - { - private static readonly Lazy s_loader = - new Lazy(() => - { - ISqlConfigurableRetryConnectionSection cnnConfig = null; - ISqlConfigurableRetryCommandSection cmdConfig = null; - - // Fetch the section attributes values from the configuration section of the app config file. - cnnConfig = AppConfigManager.FetchConfigurationSection(SqlConfigurableRetryConnectionSection.Name); - cmdConfig = AppConfigManager.FetchConfigurationSection(SqlConfigurableRetryCommandSection.Name); -#if !NETFRAMEWORK - IAppContextSwitchOverridesSection appContextSwitch = AppConfigManager.FetchConfigurationSection(AppContextSwitchOverridesSection.Name); - try - { - SqlAppContextSwitchManager.ApplyContextSwitches(appContextSwitch); - } - catch (Exception e) - { - // Don't throw an exception for an invalid config file - SqlClientEventSource.Log.TryTraceEvent(": {2}", TypeName, MethodBase.GetCurrentMethod().Name, e); - } -#endif - return new SqlConfigurableRetryLogicLoader(cnnConfig, cmdConfig); - }); - } - /// /// Configurable retry logic loader /// This class shouldn't throw exceptions; @@ -47,6 +16,27 @@ internal sealed partial class SqlConfigurableRetryLogicManager /// internal sealed partial class SqlConfigurableRetryLogicLoader { + private const string TypeName = nameof(SqlConfigurableRetryLogicLoader); + + /// + /// The default non retry provider will apply if a parameter passes by null. + /// + private void AssignProviders(SqlRetryLogicBaseProvider cnnProvider = null, SqlRetryLogicBaseProvider cmdProvider = null) + { + ConnectionProvider = cnnProvider ?? SqlConfigurableRetryFactory.CreateNoneRetryProvider(); + CommandProvider = cmdProvider ?? SqlConfigurableRetryFactory.CreateNoneRetryProvider(); + } + + /// + /// Default Retry provider for SqlConnections + /// + internal SqlRetryLogicBaseProvider ConnectionProvider { get; private set; } + + /// + /// Default Retry provider for SqlCommands + /// + internal SqlRetryLogicBaseProvider CommandProvider { get; private set; } + public SqlConfigurableRetryLogicLoader(ISqlConfigurableRetryConnectionSection connectionRetryConfigs, ISqlConfigurableRetryCommandSection commandRetryConfigs, string cnnSectionName = SqlConfigurableRetryConnectionSection.Name, diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicManager.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicManager.cs index c0299de655..cac4c04645 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicManager.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicManager.cs @@ -11,10 +11,23 @@ namespace Microsoft.Data.SqlClient /// Configurable retry logic manager; /// Receive the default providers by a loader and feeds connections and commands. /// - internal sealed partial class SqlConfigurableRetryLogicManager + internal sealed class SqlConfigurableRetryLogicManager { private const string TypeName = nameof(SqlConfigurableRetryLogicManager); + private static readonly Lazy s_loader = + new Lazy(() => + { + ISqlConfigurableRetryConnectionSection cnnConfig = null; + ISqlConfigurableRetryCommandSection cmdConfig = null; + + // Fetch the section attributes values from the configuration section of the app config file. + cnnConfig = AppConfigManager.FetchConfigurationSection(SqlConfigurableRetryConnectionSection.Name); + cmdConfig = AppConfigManager.FetchConfigurationSection(SqlConfigurableRetryCommandSection.Name); + + return new SqlConfigurableRetryLogicLoader(cnnConfig, cmdConfig); + }); + private SqlConfigurableRetryLogicManager() {/*prevent external object creation*/} /// @@ -75,33 +88,6 @@ internal static SqlRetryLogicBaseProvider CommandProvider } - /// - /// Configurable retry logic loader - /// - internal sealed partial class SqlConfigurableRetryLogicLoader - { - private const string TypeName = nameof(SqlConfigurableRetryLogicLoader); - - /// - /// The default non retry provider will apply if a parameter passes by null. - /// - private void AssignProviders(SqlRetryLogicBaseProvider cnnProvider = null, SqlRetryLogicBaseProvider cmdProvider = null) - { - ConnectionProvider = cnnProvider ?? SqlConfigurableRetryFactory.CreateNoneRetryProvider(); - CommandProvider = cmdProvider ?? SqlConfigurableRetryFactory.CreateNoneRetryProvider(); - } - - /// - /// Default Retry provider for SqlConnections - /// - internal SqlRetryLogicBaseProvider ConnectionProvider { get; private set; } - - /// - /// Default Retry provider for SqlCommands - /// - internal SqlRetryLogicBaseProvider CommandProvider { get; private set; } - } - internal interface IAppContextSwitchOverridesSection { string Value { get; set; } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj index d70b91d864..4fb650e481 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj @@ -24,7 +24,6 @@ - @@ -75,6 +74,7 @@ + @@ -297,12 +297,12 @@ - + diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicConfigHelper.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicConfigHelper.cs index 7cf4e196c9..f1ad1c98f8 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicConfigHelper.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicConfigHelper.cs @@ -30,16 +30,6 @@ public class RetryLogicConfigHelper public const string DefaultTansientErrors = "1204, 1205, 1222, 49918, 49919, 49920, 4060, 4221, 40143, 40613, 40501, 40540, 40197, 10929, 10928, 10060, 10054, 10053, 997, 233, 64, 20, 0, -2, 207, 102, 2812"; - //private const string SqlRetryLogicProviderTypeName = "Microsoft.Data.SqlClient.SqlRetryLogicProvider"; - //private const string SqlExponentialIntervalEnumeratorTypeName = "Microsoft.Data.SqlClient.SqlExponentialIntervalEnumerator"; - //private const string SqlIncrementalIntervalEnumeratorTypeName = "Microsoft.Data.SqlClient.SqlIncrementalIntervalEnumerator"; - //private const string SqlFixedIntervalEnumeratorTypeName = "Microsoft.Data.SqlClient.SqlFixedIntervalEnumerator"; - //private const string SqlNoneIntervalEnumeratorTypeName = "Microsoft.Data.SqlClient.SqlNoneIntervalEnumerator"; - - //private static readonly Type s_sqlRetryLogicBaseProviderType = typeof(SqlRetryLogicBaseProvider); - //private static readonly Type s_sqlRetryLogicProviderType = s_sqlClientAssembly.GetType(SqlRetryLogicProviderTypeName); - //private static readonly Type s_sqlRetryLogicBaseType = s_sqlClientAssembly.GetType(SqlRetryLogicBaseTypeName); - private static readonly Random s_random = new Random(); private static readonly Assembly s_sqlClientAssembly = typeof(SqlConnection).Assembly; diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicTestHelper.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicTestHelper.cs index 169d24d03a..5f5d1fe82e 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicTestHelper.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicTestHelper.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Text.RegularExpressions; @@ -45,6 +46,9 @@ public enum FilterSqlStatements public class RetryLogicTestHelper { internal const string RetryAppContextSwitch = "Switch.Microsoft.Data.SqlClient.EnableRetryLogic"; + private static readonly Assembly s_sqlClientAssembly = typeof(SqlConnection).Assembly; + private static readonly Type s_LocalAppContextSwitchesType = s_sqlClientAssembly.GetType("Microsoft.Data.SqlClient.LocalAppContextSwitches"); + private static readonly FieldInfo s_isRetryEnabledFieldInfo = s_LocalAppContextSwitchesType.GetField("s_isRetryEnabled", BindingFlags.Static | BindingFlags.NonPublic); private static readonly HashSet s_defaultTransientErrors = new HashSet @@ -79,8 +83,11 @@ private static readonly HashSet s_defaultTransientErrors internal static readonly string s_ExceedErrMsgPattern = SystemDataResourceManager.Instance.SqlRetryLogic_RetryExceeded; internal static readonly string s_CancelErrMsgPattern = SystemDataResourceManager.Instance.SqlRetryLogic_RetryCanceled; + public static void CleanRetryEnabledCache() => s_isRetryEnabledFieldInfo.SetValue(null, null); + public static void SetRetrySwitch(bool value) { + CleanRetryEnabledCache(); AppContext.SetSwitch(RetryAppContextSwitch, value); } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConfigurationManagerReliabilityTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConfigurationManagerReliabilityTest.cs index 5691029f0c..f5594069cf 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConfigurationManagerReliabilityTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConfigurationManagerReliabilityTest.cs @@ -45,6 +45,7 @@ public void LoadValidInternalTypesAndEnableSwitch(string method1, string method2 RetryLogicConfigHelper.AssessProvider(cmdProvider, cmdCfg, switchValue); // check the retry in action + RetryLogicTestHelper.CleanRetryEnabledCache(); s_connectionCRLTest.ConnectionRetryOpenInvalidCatalogFailed(TcpCnnString, cnnProvider); s_commandCRLTest.RetryExecuteFail(TcpCnnString, cmdProvider); if (DataTestUtility.IsNotAzureSynapse()) @@ -68,6 +69,7 @@ public void LoadValidInternalTypesWithoutEnablingSwitch(string method1, string m RetryLogicConfigHelper.AssessProvider(cnnProvider, cnnCfg, switchValue); RetryLogicConfigHelper.AssessProvider(cmdProvider, cmdCfg, switchValue); + RetryLogicTestHelper.CleanRetryEnabledCache(); s_connectionCRLTest.DefaultOpenWithoutRetry(TcpCnnString, cnnProvider); s_commandCRLTest.NoneRetriableExecuteFail(TcpCnnString, cmdProvider); } @@ -98,6 +100,7 @@ public void LoadCustomMethod(string typeName, string methodName) object loaderObj = RetryLogicConfigHelper.ReturnLoaderAndProviders(cnnCfg, cmdCfg, switchValue, out SqlRetryLogicBaseProvider cnnProvider, out SqlRetryLogicBaseProvider cmdProvider); Assert.NotNull(loaderObj); + RetryLogicTestHelper.CleanRetryEnabledCache(); TestConnection(cnnProvider, cnnCfg); TestCommandExecute(cmdProvider, cmdCfg); TestCommandExecuteAsync(cmdProvider, cmdCfg).Wait(); @@ -130,6 +133,7 @@ public void LoadInvalidCustomRetryLogicType(string typeName, string methodName) object loaderObj = RetryLogicConfigHelper.ReturnLoaderAndProviders(cnnCfg, cmdCfg, switchValue, out SqlRetryLogicBaseProvider cnnProvider, out SqlRetryLogicBaseProvider cmdProvider); Assert.NotNull(loaderObj); + RetryLogicTestHelper.CleanRetryEnabledCache(); s_connectionCRLTest.DefaultOpenWithoutRetry(TcpCnnString, cnnProvider); s_commandCRLTest.NoneRetriableExecuteFail(TcpCnnString, cmdProvider); } @@ -151,6 +155,7 @@ public void InvalidRetryMethodName(string methodName) Assert.NotNull(loaderObj); // none retriable logic applies. + RetryLogicTestHelper.CleanRetryEnabledCache(); s_connectionCRLTest.DefaultOpenWithoutRetry(TcpCnnString, cnnProvider); s_commandCRLTest.NoneRetriableExecuteFail(TcpCnnString, cmdProvider); } @@ -177,6 +182,7 @@ public void InvalidRetryLogicTypeWithValidInternalMethodName(string typeName) RetryLogicConfigHelper.AssessProvider(cmdProvider, cmdCfg, switchValue); // internal type used to resolve the specified method + RetryLogicTestHelper.CleanRetryEnabledCache(); s_connectionCRLTest.ConnectionRetryOpenInvalidCatalogFailed(TcpCnnString, cnnProvider); s_commandCRLTest.RetryExecuteFail(TcpCnnString, cmdProvider); } diff --git a/tools/props/Versions.props b/tools/props/Versions.props index 99b015718c..426da747ad 100644 --- a/tools/props/Versions.props +++ b/tools/props/Versions.props @@ -44,6 +44,10 @@ 4.3.0 4.3.1 + + + 4.3.0 + [1.6.0,2.0.0) diff --git a/tools/specs/Microsoft.Data.SqlClient.nuspec b/tools/specs/Microsoft.Data.SqlClient.nuspec index d8df8ccf98..693a214cff 100644 --- a/tools/specs/Microsoft.Data.SqlClient.nuspec +++ b/tools/specs/Microsoft.Data.SqlClient.nuspec @@ -74,6 +74,7 @@ When using NuGet 3.x this package requires at least version 3.4. + @@ -88,6 +89,7 @@ When using NuGet 3.x this package requires at least version 3.4. +