Skip to content

Commit daa1a74

Browse files
authored
[5.1.1] Fix | TransactionScope connection issue when Enlist is enable, Pooling is disabled and network connection type is Redirect (#1967)
1 parent 20e1535 commit daa1a74

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ private void CompleteLogin(bool enlistOK)
12351235

12361236
// for non-pooled connections, enlist in a distributed transaction
12371237
// if present - and user specified to enlist
1238-
if (enlistOK && ConnectionOptions.Enlist)
1238+
if (enlistOK && ConnectionOptions.Enlist && RoutingInfo == null)
12391239
{
12401240
_parser._physicalStateObj.SniContext = SniContext.Snix_AutoEnlist;
12411241
Transaction tx = ADP.GetCurrentTransaction();

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,7 @@ private void CompleteLogin(bool enlistOK)
15001500

15011501
// for non-pooled connections, enlist in a distributed transaction
15021502
// if present - and user specified to enlist
1503-
if (enlistOK && ConnectionOptions.Enlist)
1503+
if (enlistOK && ConnectionOptions.Enlist && _routingInfo == null)
15041504
{
15051505
_parser._physicalStateObj.SniContext = SniContext.Snix_AutoEnlist;
15061506
SysTx.Transaction tx = ADP.GetCurrentTransaction();

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public static class TransactionTest
4646
public static void ReadNextQueryAfterTxAbortedPoolEnabled(string connString)
4747
=> ReadNextQueryAfterTxAbortedTest(connString);
4848

49-
// Azure SQL has no DTC support
50-
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))]
49+
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
5150
[MemberData(nameof(PoolDisabledConnectionStrings))]
5251
public static void ReadNextQueryAfterTxAbortedPoolDisabled(string connString)
5352
=> ReadNextQueryAfterTxAbortedTest(connString);

0 commit comments

Comments
 (0)