views:

230

answers:

2

I'd like to list as much information about all the threads currently running in .NET1.0 as I can. I don't have the luxury of adding threads to an internal list of my own when they get created; I just want to dump out a list of those that are currently in the system. Does any one know a way of doing this? I've been looking at the System.Threading... namespace and right now nothing is opening up as I hoped it would.

Thanks,

Matt.

A: 

If you are able to break into the process, the .Net debugger will provide you with a list of all currently executing threads. It might also help you to know that provided you have a thread run through a code path you control, you can access it's thread object (System.Threading.Thread.CurrentThread) and give it a name, which you can then print out into any debugging messages. (Assuming .Net 1.0 has this...)

I know it's a lateral answer but it might help.

Spence
A: 

Don't know about 1.0 but in 1.1 you can use:

Process[] processlist = Process.GetProcesses();

If a Process's Modules collection contains mscoree.dll/mscorjit.dll, it is a .Net thread. The version of the .Net framework the application is running, can also be found by the information provided by the modules.

Yogesh
From MSDN it would appear it is only available in .Net 2.0 and up
mcauthorn
It is supported from 1.0 onwards as this msdn doc shows: http://msdn.microsoft.com/en-us/library/1f3ys1f9.aspx I don't have VS2003 to check it though.
Yogesh