Home All Groups Group Topic Archive Search About

Still getting 'The thread <'No Name'> ... has exited' after setting names of threads

Author
8 Jan 2007 1:37 PM
Lasse_Vågsæther_Karlsen
After executing the following code in .NET 2.0:

Thread t = new Thread(new ThreadStart(delegate
{
     Debug.WriteLine("Test");
}));
t.Name = "TestThread";
t.Start();

I still get that the thread has no name. The debug output is:

Test
The thread '<No Name>' (0x164c) has exited with code 0 (0x0).

What am I doing wrong? Is there a bug in 2.0 regarding thread names or
is there something else I need to do as well?

--
Lasse Vågsæther Karlsen
mailto:la***@vkarlsen.no

Author
10 Jan 2007 5:30 PM
Alvin Bruney [MVP]
I think it's to do with the console window. I did run your code and was able
to reproduce it, but you should note that the thread is indeed named
correctly in the thread window.

Show quote
"Lasse Vågsæther Karlsen" wrote:

> After executing the following code in .NET 2.0:
>
> Thread t = new Thread(new ThreadStart(delegate
> {
>      Debug.WriteLine("Test");
> }));
> t.Name = "TestThread";
> t.Start();
>
> I still get that the thread has no name. The debug output is:
>
> Test
> The thread '<No Name>' (0x164c) has exited with code 0 (0x0).
>
> What am I doing wrong? Is there a bug in 2.0 regarding thread names or
> is there something else I need to do as well?
>
> --
> Lasse Vågsæther Karlsen
> mailto:la***@vkarlsen.no
>

AddThis Social Bookmark Button