[Mono-bugs] [Bug 50049][Maj] Changed - MonoThread domain-specific handling broken

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 7 Sep 2004 20:50:02 -0400 (EDT)


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 bmaurer@users.sf.net.

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

--- shadow/50049	2004-07-01 22:57:16.000000000 -0400
+++ shadow/50049.tmp.16200	2004-09-07 20:50:02.000000000 -0400
@@ -64,6 +64,63 @@
 
 ------- Additional Comments From lupus@ximian.com  2004-06-30 11:16 -------
 *** Bug 55978 has been marked as a duplicate of this bug. ***
 
 ------- Additional Comments From gonzalo@ximian.com  2004-07-01 22:57 -------
 *** Bug 60445 has been marked as a duplicate of this bug. ***
+
+------- Additional Comments From bmaurer@users.sf.net  2004-09-07 20:50 -------
+Today we talked on IRC a little about this. Dick again mentioned that
+MS.NET seems to use one Thread object across appdomains. It seems that
+other properties of the Thread are propogated across appdomains too
+
+using System;
+
+using System.Threading;
+
+using System.Globalization;
+
+
+
+public class X : MarshalByRefObject {
+
+	static void Main () {
+
+		AppDomain d = AppDomain.CreateDomain("d");
+
+		X x = (X) d.CreateInstanceFromAndUnwrap ("t.exe", "X");
+
+		Console.WriteLine (Thread.CurrentThread.CurrentCulture);
+
+		x.Foo ();
+
+		Console.WriteLine (Thread.CurrentThread.CurrentCulture);
+
+	}
+
+   
+
+	void Foo () {
+
+		Console.WriteLine ("I'm in Foo");
+
+		Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
+
+		
+
+	}
+
+}
+
+
+
+In this test case, the culture in the root domain gets changed to the
+invariant culture. Even if we did a hack where we detected changes to
+the CurrentCulture in one Thread object and made the changes on the
+other domains' thread objects, this would not account for changes to
+the fields of CurrentCulture.
+
+From what I can tell, all instance members of Thread apply their
+changes across all appdomains (ie, they are thread-local). An example
+is CurrentCulture. All the static members apply their changes to the
+tread-appdomain (ie, they are thread local, appdomain local). An
+example is GetData.