[Mono-bugs] [Bug 80343][Wis] Changed - Threads are using TransactionScope of each other

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Dec 23 19:45:23 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by robertj at gmx.net.

http://bugzilla.ximian.com/show_bug.cgi?id=80343

--- shadow/80343	2006-12-22 11:03:11.000000000 -0500
+++ shadow/80343.tmp.21461	2006-12-23 19:45:23.000000000 -0500
@@ -1,22 +1,21 @@
 Bug#: 80343
 Product: Mono: Class Libraries
 Version: 1.2
-OS: 
+OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Wishlist
 Component: System
 AssignedTo: mono-bugs at ximian.com                            
 ReportedBy: adriaanvk at gmail.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
 URL: 
-Cc: 
 Summary: Threads are using TransactionScope of each other
 
 Please fill in this template when reporting a bug, unless you know what you
 are doing.
 Description of Problem:
 in an application using System.Transactions in multithreaded system,
@@ -51,6 +50,48 @@
 Have a patch for it
 
 ------- Additional Comments From adriaanvk at gmail.com  2006-12-22 11:03 -------
 Created an attachment (id=18361)
 a patch for this bug -> used managedthreadid to separate transactionscopes
 
+
+------- Additional Comments From robertj at gmx.net  2006-12-23 19:45 -------
+The following test case returns "true" "false" on MS.NET, so it
+seems that transaction are actually thread-local:
+
+using System;
+using System.Transactions;
+using System.Threading;
+
+class T
+{
+	static void Main ()
+	{
+		using (TransactionScope scope = new TransactionScope ()) {
+			Console.WriteLine (Transaction.Current != null);
+			new Thread (delegate () {
+				Console.WriteLine (Transaction.Current != null);
+			}).Start ();
+			scope.Complete ();
+		}
+
+	}
+}
+
+
+
+A straightforward fix:
+
+
+Index: System.Transactions/Transaction.cs
+===================================================================
+--- System.Transactions/Transaction.cs	(revision 69432)
++++ System.Transactions/Transaction.cs	(working copy)
+@@ -21,6 +21,7 @@
+ 	[Serializable]
+ 	public class Transaction : IDisposable, ISerializable
+ 	{
++		[ThreadStatic]
+ 		static Transaction ambient;
+ 
+ 		IsolationLevel level;
+


More information about the mono-bugs mailing list