Inconsistent behaviour of System.Transactions

Inconsistent behaviour of System.Transactions

Post by Matthijs t » Mon, 13 Nov 2006 22:32:04


I'm working on an opensource project, which encapsulates
System.Transactions. (and does many other things...). See

The part which covers Transactions is tested for 96%. When running the tests
a couple of times after each other (without source changes, same build of
all libraries involved), sometimes the tests fail, most of the time they

Of course, I tried the tests on a clean install of WinXP Prof with .NET 2.0
installed. The same behaviour as described above.

The tests do the following: implement a resource manager using the
IEnlistmentNotification interface and register it using
Transaction.Current.EnlistDurable, passing EnlistmentOptions.None as

During the tests, during IEnlistmentNotification.Commit, Enlistment.Done is
_not_ called, so the transaction should be rolled back.

Can anybody help me on how to proceed? Should I log the bug somewhere? Are
there any known workarounds....


Matthijs ter Woord

1. Convert System.Transactions.Transaction.Current to System.Data.Common.DbTransaction?

2. System.Transactions.Transaction.TransactionCompleted Event coming on a different thread.


1. I started a Transaction using System.Transactions.TransactionScope
I checked Thread.CurrentThread.GetHashCode()
2. I subscribed to the System.Transactions.Transaction.TransactionCompleted
3. After sometime I receive the notification to my delegate for this event.
4. I checked again, Thread.CurrentThread.GetHashCode() , but now this time
it is different from the previously recorded GetHashCode().
5. Is Microsoft retarded? It stopped the initial thread, and informed my
code about the transaction completion using a different thread.
6. I have some thread specific code (using [ThreadStatic]), and it is
driving me crazy how microsoft has implemented this event.
7. It took a couple of hours just to find what the actual problem is.

Any ideas, workarounds?



3. Inconsistent behavior when requerying to update a control

4. Emailing from Access application - inconsistent behaviour with SendObject

5. ClearType and TextRenderingHint : Inconsistent behavior

6. ATL OOM Resource leaks, and inconsistent behavior?

7. Editing Parent Table does not update Child Table... inconsistent behaviour.

8. Inconsistent behavior of an button performing a postback when a button is clicked.

9. Graphics.DrawString inconsistent drawing behavior on Dell Axim x50v (640x480)

10. Inconsistent behaviour between NETCF2 and NET2 on Sockets or CF2 Bug?

11. Yet More Bizarre Behavior -- Inconsistent Property Deserialization

12. ComboBox behavior-- inconsistent... wrong record chosen

13. Inconsistent Form Open behavior

14. Inconsistent Behaviour of Union Select Query

15. Access 2003 database inconsistent behaviour between Vista and XP