Skip to content

Commit d345041

Browse files
author
Johnny Pham
authored
Merge pull request dotnet#563 from johnnypham/nullRefEx-in-promoteTxnFix
Fix for null reference exceptions in SqlDelegatedTransaction methods
2 parents ffc6bd0 + 1d9e47a commit d345041

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public byte[] Promote()
221221
else
222222
{
223223
// The transaction was aborted externally, doom the connection to make sure it's eventually rolled back and log the same.
224-
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.Promote|RES|CPOOL> {0}, Connection {1}, aborted before promoting.", ObjectID, connection.ObjectID);
224+
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.Promote|RES|CPOOL> {0}, Connection null, aborted before promoting.", ObjectID);
225225
}
226226
return returnValue;
227227
}
@@ -304,7 +304,7 @@ public void Rollback(SinglePhaseEnlistment enlistment)
304304
{
305305
// The transaction was aborted, report that to SysTx and log the same.
306306
enlistment.Aborted();
307-
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.Rollback|RES|CPOOL> {0}, Connection {1}, aborted before rollback.", ObjectID, connection.ObjectID);
307+
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.Rollback|RES|CPOOL> {0}, Connection null, aborted before rollback.", ObjectID);
308308
}
309309
}
310310

@@ -421,7 +421,7 @@ public void SinglePhaseCommit(SinglePhaseEnlistment enlistment)
421421
{
422422
// The transaction was aborted before we could commit, report that to SysTx and log the same.
423423
enlistment.Aborted();
424-
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.SinglePhaseCommit|RES|CPOOL> {0}, Connection {1}, aborted before commit.", ObjectID, connection.ObjectID);
424+
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.SinglePhaseCommit|RES|CPOOL> {0}, Connection null, aborted before commit.", ObjectID);
425425
}
426426
}
427427

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public Byte[] Promote()
268268
else
269269
{
270270
// The transaction was aborted externally, doom the connection to make sure it's eventually rolled back and log the same.
271-
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.Promote|RES|CPOOL> {0}, Connection {1}, aborted before promote.", ObjectID, connection.ObjectID);
271+
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.Promote|RES|CPOOL> {0}, Connection null, aborted before promoting.", ObjectID);
272272
}
273273
return returnValue;
274274
}
@@ -364,7 +364,7 @@ public void Rollback(SysTx.SinglePhaseEnlistment enlistment)
364364
{
365365
// The transaction was aborted, report that to SysTx and log the same.
366366
enlistment.Aborted();
367-
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.Rollback|RES|CPOOL> {0}, Connection {1}, aborted before rollback.", ObjectID, connection.ObjectID);
367+
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.Rollback|RES|CPOOL> {0}, Connection null, aborted before rollback.", ObjectID);
368368
}
369369
}
370370

@@ -501,7 +501,7 @@ public void SinglePhaseCommit(SysTx.SinglePhaseEnlistment enlistment)
501501
{
502502
// The transaction was aborted before we could commit, report that to SysTx and log the same.
503503
enlistment.Aborted();
504-
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.SinglePhaseCommit|RES|CPOOL> {0}, Connection {1}, aborted before commit.", ObjectID, connection.ObjectID);
504+
SqlClientEventSource.Log.TraceEvent("<sc.SqlDelegatedTransaction.SinglePhaseCommit|RES|CPOOL> {0}, Connection null, aborted before commit.", ObjectID);
505505
}
506506
}
507507

0 commit comments

Comments
 (0)