-
Notifications
You must be signed in to change notification settings - Fork 5k
Bring over distributed transactions support for Windows #71433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Awesome. Nice work, @roji. |
src/libraries/System.Transactions/src/System/Transactions/Oletx/CoTaskMemHandle.cs
Show resolved
Hide resolved
SuppressUnmanagedCodeSecurity] | ||
public static extern CoTaskMemHandle Alloc(IntPtr size); | ||
*/ | ||
[DllImport("ole32.dll"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you said you've yet to clean up the managed code, so just for tracking purposes, we'll want to convert the DllImports to LibraryImports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this possible, given that this uses [MarshalAs(UnmanagedType.Interface)]
? /cc @AaronRobinsonMSFT
src/libraries/System.Transactions/src/System/Transactions/Oletx/CoTaskMemHandle.cs
Show resolved
Hide resolved
src/libraries/System.Transactions/src/System/Transactions/Oletx/DTCTransactionManager.cs
Show resolved
Hide resolved
src/libraries/System.Transactions/src/System/Transactions/Oletx/DTCTransactionManager.cs
Show resolved
Hide resolved
What are the reasons to implement this as an unmanaged shim and not just C#? The unmanaged shim will require special build and packaging logic that is not straightforward. We do not have OOB Windows library with unmanaged shim like this, so you are likely going to need to do some build infrastructure work for this. EDIT: I have not realized that this is inbox library, so the new packaging logic should not be required. My question still remains. |
/// clones have the same capabilities as the original transaction, except for the ability to commit | ||
/// the transaction. | ||
/// </summary> | ||
[Serializable] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect we'll want to strip out most or all of the serialization-related support.
cc: @GrabYourPitchforks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I still need to do some research, but from what I understand, System.Transactions had functionality where attempting to send a Transaction across AppDomain boundaries would automatically trigger escalation to a distributed transaction, and then propagate the transaction via OleTx. I think this relied on BinaryFormatter, and I definitely don't think we need to do this.
We can always see if we get user demand in the future for this (I doubt it), and if so, reimplement this in some safer way.
src/libraries/System.Transactions/src/System/Transactions/Oletx/DtcInterfaces.cs
Show resolved
Hide resolved
src/libraries/System.Transactions/src/System/Transactions/Oletx/OletxResourceManager.cs
Show resolved
Hide resolved
The native code was brought over from netfx as-is - with almost zero changes - the idea being that we want to avoid any risky rewriting which would make this more complex. I don't foresee us working on this much: the goal here is mostly to unblock people still stuck on netfx because their application requires distributed transactions. Makes sense? |
I have doubts that this is saving us work in the long run. C/C++ code is high maintenance. It requires updates to the latest SDL requirements every release (like #66154). It needs special handling during the build, packaging, trimming and single-file. etc. Unfortunately, this is inbox library so we will be stuck with this nearly forever, |
src/libraries/System.Transactions/src/System/Transactions/Oletx/DTCTransactionManager.cs
Show resolved
Hide resolved
Closing in favor of #72051, which ports the C++ DtcProxyShim to .NET. |
@stephentoub @AaronRobinsonMSFT here's a draft PR bringing over Windows support for distributed transactions from netfx.
/cc @ajcvickers