Skip to content

Commit a2cf637

Browse files
Block distributed transaction usage on arm64 (#74570)
And fix GUID interop in distributed transactions See #74170 (cherry picked from commit fdfef13) Co-authored-by: Shay Rojansky <[email protected]>
1 parent f115515 commit a2cf637

19 files changed

+48
-32
lines changed

src/libraries/System.Transactions.Local/src/Resources/Strings.resx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,10 @@
420420
<data name="TraceSourceBase" xml:space="preserve">
421421
<value>[Base]</value>
422422
</data>
423-
<data name="DistributedNotSupportOn32Bits" xml:space="preserve">
423+
<data name="DistributedNotSupportedOn32Bits" xml:space="preserve">
424424
<value>Distributed transactions are currently unsupported in 32-bit processes.</value>
425425
</data>
426-
</root>
426+
<data name="DistributedNotSupportedOnArm" xml:space="preserve">
427+
<value>Distributed transactions are currently unsupported on ARM.</value>
428+
</data>
429+
</root>

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/IPrepareInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

76
namespace System.Transactions.DtcProxyShim.DtcInterfaces;

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/IResourceManagerFactory2.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ namespace System.Transactions.DtcProxyShim.DtcInterfaces;
1010
internal interface IResourceManagerFactory2
1111
{
1212
internal void Create(
13-
Guid pguidRM,
13+
in Guid pguidRM,
1414
[MarshalAs(UnmanagedType.LPStr)] string pszRMName,
1515
[MarshalAs(UnmanagedType.Interface)] IResourceManagerSink pIResMgrSink,
1616
[MarshalAs(UnmanagedType.Interface)] out IResourceManager rm);
1717

1818
internal void CreateEx(
19-
Guid pguidRM,
19+
in Guid pguidRM,
2020
[MarshalAs(UnmanagedType.LPStr)] string pszRMName,
2121
[MarshalAs(UnmanagedType.Interface)] IResourceManagerSink pIResMgrSink,
22-
Guid riidRequested,
22+
in Guid riidRequested,
2323
[MarshalAs(UnmanagedType.Interface)] out object rm);
2424
}

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransaction.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
6-
using System.Transactions.Oletx;
75

86
namespace System.Transactions.DtcProxyShim.DtcInterfaces;
97

@@ -12,7 +10,7 @@ namespace System.Transactions.DtcProxyShim.DtcInterfaces;
1210
internal interface ITransaction
1311
{
1412
void Commit(
15-
[MarshalAs(UnmanagedType.Bool)] bool fRetainingt,
13+
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
1614
[MarshalAs(UnmanagedType.U4)] OletxXacttc grfTC,
1715
uint grfRM);
1816

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionCloner.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

76
namespace System.Transactions.DtcProxyShim.DtcInterfaces;

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionDispenser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace System.Transactions.DtcProxyShim.DtcInterfaces;
99

10-
// https://docs.microsoft.com/previous-versions/windows/desktop/ms679525(v=vs.85)
10+
// https://docs.microsoft.com/previous-versions/windows/desktop/ms687604(v=vs.85)
1111
[ComImport, Guid(Guids.IID_ITransactionDispenser), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
1212
internal interface ITransactionDispenser
1313
{

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionEnlistmentAsync.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

76
namespace System.Transactions.DtcProxyShim.DtcInterfaces;

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionExport.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

76
namespace System.Transactions.DtcProxyShim.DtcInterfaces;

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionExportFactory.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

76
namespace System.Transactions.DtcProxyShim.DtcInterfaces;

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionImport.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

76
namespace System.Transactions.DtcProxyShim.DtcInterfaces;
@@ -13,6 +12,6 @@ internal interface ITransactionImport
1312
void Import(
1413
uint cbTransactionCookie,
1514
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] rgbTransactionCookie,
16-
Guid piid,
15+
in Guid piid,
1716
[MarshalAs(UnmanagedType.Interface)] out object ppvTransaction);
1817
}

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionOptions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

76
namespace System.Transactions.DtcProxyShim.DtcInterfaces;

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionOutcomeEvents.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,21 @@ namespace System.Transactions.DtcProxyShim.DtcInterfaces;
1010
[ComImport, Guid("3A6AD9E2-23B9-11cf-AD60-00AA00A74CCD"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
1111
internal interface ITransactionOutcomeEvents
1212
{
13-
void Committed([MarshalAs(UnmanagedType.Bool)] bool fRetaining, IntPtr pNewUOW /* always null? */, int hresult);
13+
void Committed(
14+
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
15+
IntPtr pNewUOW,
16+
int hresult);
1417

15-
void Aborted(IntPtr pboidReason, [MarshalAs(UnmanagedType.Bool)] bool fRetaining, IntPtr pNewUOW, int hresult);
18+
void Aborted(
19+
IntPtr pboidReason,
20+
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
21+
IntPtr pNewUOW,
22+
int hresult);
1623

17-
void HeuristicDecision([MarshalAs(UnmanagedType.U4)] OletxTransactionHeuristic dwDecision, IntPtr pboidReason, int hresult);
24+
void HeuristicDecision(
25+
[MarshalAs(UnmanagedType.U4)] OletxTransactionHeuristic dwDecision,
26+
IntPtr pboidReason,
27+
int hresult);
1828

1929
void Indoubt();
2030
}

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionReceiver.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

76
namespace System.Transactions.DtcProxyShim.DtcInterfaces;

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionReceiverFactory.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

76
namespace System.Transactions.DtcProxyShim.DtcInterfaces;

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
6-
using System.Transactions.Oletx;
75

86
namespace System.Transactions.DtcProxyShim.DtcInterfaces;
97

@@ -19,7 +17,10 @@ void PrepareRequest(
1917

2018
void CommitRequest(OletxXactRm grfRM, IntPtr pNewUOW);
2119

22-
void AbortRequest(IntPtr pboidReason, [MarshalAs(UnmanagedType.Bool)] bool fRetaining, IntPtr pNewUOW);
20+
void AbortRequest(
21+
IntPtr pboidReason,
22+
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
23+
IntPtr pNewUOW);
2324

2425
void TMDown();
2526
}

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionTransmitter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

76
namespace System.Transactions.DtcProxyShim.DtcInterfaces;

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionTransmitterFactory.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

76
namespace System.Transactions.DtcProxyShim.DtcInterfaces;

src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionVoterNotifyAsync2.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,21 @@ namespace System.Transactions.DtcProxyShim.DtcInterfaces;
1010
[ComImport, Guid("5433376B-414D-11d3-B206-00C04FC2F3EF"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
1111
internal interface ITransactionVoterNotifyAsync2
1212
{
13-
void Committed([MarshalAs(UnmanagedType.Bool)] bool fRetaining, IntPtr pNewUOW /* always null? */, uint hresult);
13+
void Committed(
14+
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
15+
IntPtr pNewUOW,
16+
uint hresult);
1417

15-
void Aborted(IntPtr pboidReason, [MarshalAs(UnmanagedType.Bool)] bool fRetaining, IntPtr pNewUOW, uint hresult);
18+
void Aborted(
19+
IntPtr pboidReason,
20+
[MarshalAs(UnmanagedType.Bool)] bool fRetaining,
21+
IntPtr pNewUOW,
22+
uint hresult);
1623

17-
void HeuristicDecision([MarshalAs(UnmanagedType.U4)] OletxTransactionHeuristic dwDecision, IntPtr pboidReason, uint hresult);
24+
void HeuristicDecision(
25+
[MarshalAs(UnmanagedType.U4)] OletxTransactionHeuristic dwDecision,
26+
IntPtr pboidReason,
27+
uint hresult);
1828

1929
void Indoubt();
2030

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,14 @@ public void ConnectToProxy(
5959
out byte[] whereabouts,
6060
out ResourceManagerShim resourceManagerShim)
6161
{
62-
if (RuntimeInformation.ProcessArchitecture == Architecture.X86)
62+
switch (RuntimeInformation.ProcessArchitecture)
6363
{
64-
throw new PlatformNotSupportedException(SR.DistributedNotSupportOn32Bits);
64+
case Architecture.X86:
65+
throw new PlatformNotSupportedException(SR.DistributedNotSupportedOn32Bits);
66+
67+
case Architecture.Armv6: // #74170
68+
case Architecture.Arm64:
69+
throw new PlatformNotSupportedException(SR.DistributedNotSupportedOnArm);
6570
}
6671

6772
ConnectToProxyCore(nodeName, resourceManagerIdentifier, managedIdentifier, out nodeNameMatches, out whereabouts, out resourceManagerShim);

0 commit comments

Comments
 (0)