Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Leave the ILLink warning in the product code so app developers get a …
…warning that Distributed transactions don't work with trimming.
  • Loading branch information
eerhardt committed Sep 8, 2022
commit 1a577f757d4d08faa5cf18944609260fa899b0d6
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<linker>
<assembly fullname="System.Transactions.Local">
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:System.Transactions.DtcProxyShim.DtcProxyShimFactory.ConnectToProxy(System.String,System.Guid,System.Object,System.Boolean@,System.Byte[]@,System.Transactions.DtcProxyShim.ResourceManagerShim@)</property>
<property name="Justification">This warning is left in the product so developers get an ILLink warning when trimming an app using this transaction support</property>
</attribute>
</assembly>
</linker>
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ private static extern void DtcGetTransactionManagerExW(
object? pvConfigPararms,
[MarshalAs(UnmanagedType.Interface)] out ITransactionDispenser ppvObject);

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2050:COMMarshalling",
Justification = "The DynamicDependency attributes ensure the necessary IL is preserved.")]
[RequiresUnreferencedCode("Distributed transactions are not compatible with trimming. Correctness of the application cannot be guaranteed after trimming.")]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(ITransactionDispenser))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(ITransactionOptions))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(ITransaction))]
Expand All @@ -69,6 +68,9 @@ private static extern void DtcGetTransactionManagerExW(
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(ITransactionTransmitter))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(ITransactionReceiverFactory))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(ITransactionReceiver))]
private static void DtcGetTransactionManager(string? nodeName, out ITransactionDispenser localDispenser) =>
DtcGetTransactionManagerExW(nodeName, null, Guids.IID_ITransactionDispenser_Guid, 0, null, out localDispenser);

public void ConnectToProxy(
string? nodeName,
Guid resourceManagerIdentifier,
Expand All @@ -84,7 +86,9 @@ public void ConnectToProxy(

lock (_proxyInitLock)
{
DtcGetTransactionManagerExW(nodeName, null, Guids.IID_ITransactionDispenser_Guid, 0, null, out ITransactionDispenser? localDispenser);
#pragma warning disable IL2026 // This warning is left in the product so developers get an ILLink warning when trimming an app using this transaction support
DtcGetTransactionManager(nodeName, out ITransactionDispenser? localDispenser);
#pragma warning restore IL2026

// Check to make sure the node name matches.
if (nodeName is not null)
Expand Down