Skip to content

Commit 699bdcb

Browse files
committed
Address review comments
1 parent be2a110 commit 699bdcb

16 files changed

+19
-42
lines changed

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DTCInterfaces/ITransactionResourceAsync.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal interface ITransactionResourceAsync
2424
/// </summary>
2525
/// <param name="fRetaining">Always false.</param>
2626
/// <param name="grfRM">Values from <see cref="OletxXactRm" />.</param>
27-
/// <param name="fWantMoniker">Always false.</param> // TODO
27+
/// <param name="fWantMoniker">Always false.</param>
2828
/// <param name="fSinglePhase">If true, it indicates that the RM is the only resource manager enlisted on the transaction.</param>
2929
void PrepareRequest(
3030
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcProxyShimFactory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void BeginTransaction(
135135
out Guid transactionIdentifier,
136136
out TransactionShim transactionShim)
137137
{
138-
var options = GetCachedOptions();
138+
ITransactionOptions options = GetCachedOptions();
139139

140140
try
141141
{
@@ -197,7 +197,7 @@ public void ReceiveTransaction(
197197
out OletxTransactionIsolationLevel isolationLevel,
198198
out TransactionShim transactionShim)
199199
{
200-
var receiver = GetCachedReceiver();
200+
ITransactionReceiver receiver = GetCachedReceiver();
201201

202202
try
203203
{
@@ -250,7 +250,7 @@ public void GetNotification(
250250

251251
Monitor.Enter(_notificationLock);
252252

253-
var entryRemoved = _notifications.TryDequeue(out NotificationShimBase? notification);
253+
bool entryRemoved = _notifications.TryDequeue(out NotificationShimBase? notification);
254254
if (entryRemoved)
255255
{
256256
managedIdentifier = notification!.EnlistmentIdentifier;

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/EnlistmentNotifyShim.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ internal void SetIgnoreSpuriousProxyNotifications()
3333

3434
public void PrepareRequest(bool fRetaining, OletxXactRm grfRM, bool fWantMoniker, bool fSinglePhase)
3535
{
36-
var pEnlistmentAsync = Interlocked.Exchange(ref EnlistmentAsync, null);
36+
ITransactionEnlistmentAsync? pEnlistmentAsync = Interlocked.Exchange(ref EnlistmentAsync, null);
3737

3838
if (pEnlistmentAsync is null)
3939
{

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/Guids.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
namespace System.Transactions.DtcProxyShim;
88

9-
// TODO: Is this the right to manage these COM IIDs?
109
internal static class Guids
1110
{
1211
internal const string IID_ITransactionDispenser = "3A6AD9E1-23B9-11cf-AD60-00AA00A74CCD";

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/OletxHelper.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal static void Retry(Action action)
3434
{
3535
int nRetries = MaxRetryCount;
3636

37-
while (nRetries > 0)
37+
while (true)
3838
{
3939
try
4040
{
@@ -43,8 +43,12 @@ internal static void Retry(Action action)
4343
}
4444
catch (COMException e) when (e.ErrorCode == XACT_E_ALREADYINPROGRESS)
4545
{
46+
if (--nRetries == 0)
47+
{
48+
throw;
49+
}
50+
4651
Thread.Sleep(RetryInterval);
47-
nRetries--;
4852
}
4953
}
5054
}

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/ResourceManagerShim.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void Enlist(
2525
var pEnlistmentNotifyShim = new EnlistmentNotifyShim(_shimFactory, managedIdentifier);
2626
var pEnlistmentShim = new EnlistmentShim(pEnlistmentNotifyShim);
2727

28-
var transaction = transactionShim.Transaction;
28+
ITransaction transaction = transactionShim.Transaction;
2929
ResourceManager!.Enlist(transaction, pEnlistmentNotifyShim, out Guid txUow, out OletxTransactionIsolationLevel isoLevel, out ITransactionEnlistmentAsync pEnlistmentAsync);
3030

3131
pEnlistmentNotifyShim.EnlistmentAsync = pEnlistmentAsync;

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/TransactionShim.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void GetITransactionNative(out IDtcTransaction transactionNative)
6262

6363
public unsafe byte[] GetPropagationToken()
6464
{
65-
var transmitter = _shimFactory.GetCachedTransmitter(Transaction);
65+
ITransactionTransmitter transmitter = _shimFactory.GetCachedTransmitter(Transaction);
6666

6767
try
6868
{

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/VoterShim.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal VoterBallotShim(DtcProxyShimFactory shimFactory, VoterNotifyShim notify
1616

1717
public void Vote(bool voteYes)
1818
{
19-
var voteHr = OletxHelper.S_OK;
19+
int voteHr = OletxHelper.S_OK;
2020

2121
if (!voteYes)
2222
{

src/libraries/System.Transactions.Local/src/System/Transactions/NonWindowsUnsupported.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,3 @@ internal static Exception NotSupported()
197197
=> new PlatformNotSupportedException(SR.DistributedNotSupported);
198198
}
199199
}
200-
201-
namespace System.Transactions.Diagnostics
202-
{
203-
}

src/libraries/System.Transactions.Local/src/System/Transactions/Oletx/OletxDependentTransaction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void Complete()
4343

4444
Debug.Assert(Disposed == 0, "OletxTransction object is disposed");
4545

46-
int localCompleted = Interlocked.CompareExchange(ref _completed, 1, 0);
46+
int localCompleted = Interlocked.Exchange(ref _completed, 1);
4747
if (localCompleted == 1)
4848
{
4949
throw TransactionException.CreateTransactionCompletedException(DistributedTxId);

0 commit comments

Comments
 (0)