Skip to content

Make distributed transactions code trimmable (on Windows) #76791

@roji

Description

@roji

The way that System.Transactions is currently factored makes it impossible to trim the distributed transactions code when it's not used (note that this affects Windows only, other platforms don't have this code). Some initial work was done in 7.0 by @teo-tsirpanis (thanks!), see #76376 (comment) and below - but the bulk of the code remains untrimmable.

This could be done by refactoring all distributed transactions code into an implementation of an interface (these are currently called DtcTransactionConnector and ITransactionConnector respectively), so that instead of static calls directly to distributed transaction code, we go through a static member which have the interface type. That member is only set to the implementation when the TransactionManager.ImplicitDistributedTransactions flag is set, so when it's not set, the implementation (and all its dependencies) can be trimmed.

/cc @teo-tsirpanis @jkotas @ajcvickers

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions