Click to See Complete Forum and Search --> : Exceptions and Threads


DeepT
October 8th, 2008, 01:33 PM
If you start a thread, and somewhere in the thread an exception is thrown, but not caught in that thread, what happens?

Something like:
try
{
MyThread.Start();
}
catch
{
}


Does the exception propagate up to the thread or process that started it?

Or does your program crash with an unhandled exception error?

ahoodin
October 8th, 2008, 01:49 PM
Well I woulda thought otherwise, but it appears that if a thread doesn't have an exception handler in C# (.net 2.0+)and an exception goes unhandled, it kills the whole app. Apparently a global exception handler isnt good enough in C#. AKA each thread must handle its own exceptions in C#.

http://www.albahari.com/threading/

DeepT
October 8th, 2008, 02:07 PM
Thanks for that answer, it is what I suspected. Ill review the link you sent me.