From 4dbc8efe4e5dace62be785be15eba97ac1a79913 Mon Sep 17 00:00:00 2001 From: topke011 Date: Sat, 18 Mar 2023 09:36:37 +0100 Subject: [PATCH 1/3] Fixing tran scope issue when redirect token is present --- .../src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs index ee8d211e7b..748483b49d 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs @@ -1500,7 +1500,7 @@ private void CompleteLogin(bool enlistOK) // for non-pooled connections, enlist in a distributed transaction // if present - and user specified to enlist - if (enlistOK && ConnectionOptions.Enlist) + if (enlistOK && ConnectionOptions.Enlist && _routingInfo == null) { _parser._physicalStateObj.SniContext = SniContext.Snix_AutoEnlist; SysTx.Transaction tx = ADP.GetCurrentTransaction(); From c8a729f6f2a33a363cbf952cbd7ebd23921f4f27 Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Tue, 21 Mar 2023 14:29:05 -0700 Subject: [PATCH 2/3] Apply the fix from netfx to netcore --- .../src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs index e977641175..49c0883e3d 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs @@ -1235,7 +1235,7 @@ private void CompleteLogin(bool enlistOK) // for non-pooled connections, enlist in a distributed transaction // if present - and user specified to enlist - if (enlistOK && ConnectionOptions.Enlist) + if (enlistOK && ConnectionOptions.Enlist && RoutingInfo == null) { _parser._physicalStateObj.SniContext = SniContext.Snix_AutoEnlist; Transaction tx = ADP.GetCurrentTransaction(); From 0ba0c82776ad9e3106e46fbe11184308e82c13e8 Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Wed, 22 Mar 2023 13:00:38 -0700 Subject: [PATCH 3/3] Remove the conditional theory for the transaction test so it can run on azure db --- .../tests/ManualTests/SQL/TransactionTest/TransactionTest.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionTest.cs index 9d1c5c6b5f..da1d0cdeab 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionTest.cs @@ -46,8 +46,7 @@ public static class TransactionTest public static void ReadNextQueryAfterTxAbortedPoolEnabled(string connString) => ReadNextQueryAfterTxAbortedTest(connString); - // Azure SQL has no DTC support - [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))] + [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] [MemberData(nameof(PoolDisabledConnectionStrings))] public static void ReadNextQueryAfterTxAbortedPoolDisabled(string connString) => ReadNextQueryAfterTxAbortedTest(connString);