|
-
October 8th, 2008, 01:33 PM
#1
Exceptions and Threads
If you start a thread, and somewhere in the thread an exception is thrown, but not caught in that thread, what happens?
Something like:
Code:
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?
-
October 8th, 2008, 01:49 PM
#2
Re: Exceptions and Threads
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/
Last edited by ahoodin; October 8th, 2008 at 01:51 PM.
ahoodin
To keep the plot moving, that's why.

-
October 8th, 2008, 02:07 PM
#3
Re: Exceptions and Threads
Thanks for that answer, it is what I suspected. Ill review the link you sent me.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|