views:

399

answers:

3

HI,

I have a .NET application which uses threads excessively. At the time of exit the process does not kill itself. Is there is any tool that can show what is causing the problem? although I have checked thoroughly but was unable to find the problem.

Abdul Khaliq

+1  A: 

Normally, attaching with a debugger should tell you what threads are still active and what code is running on them.

Barry Kelly
+7  A: 

See: Why doesn't my process terminate even after main thread terminated

Assaf Lavie
the msdn link provided on the site is not working heres is an update.http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemthreadingthreadclassisbackgroundtopic.asp
Abdul Khaliq
orig link works now..
Assaf Lavie
+2  A: 

That means you have some foreground thread running. A .net application will not terminate unless all the foreground threads complete execution.

You can mark threads as Background Threads and then check (Thread.IsBackground property). Please note that all background threads terminate immediately when application exits. If you are doing some important work in those threads like serializing data to database then you should keep them as foreground threads only. Background threads are good for non critical things like spell cheker etc.

chikak