[Mono-list] ThreadStatic attribute not working?
Eddy Young
jeyoung@priscimon.com
Tue, 22 Feb 2005 17:19:04 +0000
Hi all,
This is my first post here, so I may be putting this on the wrong list, in
which case please let me know.
The ThreadAttribute does not seem to be working properly on Windows, Linux
and Mac OS X. In the following code, s2 returns a null value when compiled
with Mono, but returns the correct value when compiled with MS .NET.
--- CODE BEGIN ---
using System;
public class ThreadStaticTest
{
public static void Main(string[] args)
{
string s1 = "abc";
TestRegistry.Current = s1;
string s2 = TestRegistry.Current;
Console.WriteLine(s2 != null);
}
}
class TestRegistry
{
[ThreadStatic]
private static string _testString;
public static string Current
{
get { return _testString; }
set { _testString = value; }
}
}
--- CODE END ---
I would very much appreciate to know if this is a bug or by design.
Regards.
--
http://coding.mu
http://priscimon.com/blog
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/