G
Guest
I have a program with the following lines:
Thread thread = new Thread(new ThreadStart(Execute));
thread.Start();
I want to be able to handle any exceptions that are thrown by execute that
aren't handled in the execute method in the code that spawned the thread. In
other words, I would like to write the following:
try{
thread.Start()
}
catch{
//Handle any exception thrown by thread.start so my program doesn't crash
}
However, when I write this code, if Execute throws an exception, it bubbles
to the top of the thread and then crashes the entire program. Is there a way
to catch an exception from the thread so my program doesn't crash? Thanks
Thread thread = new Thread(new ThreadStart(Execute));
thread.Start();
I want to be able to handle any exceptions that are thrown by execute that
aren't handled in the execute method in the code that spawned the thread. In
other words, I would like to write the following:
try{
thread.Start()
}
catch{
//Handle any exception thrown by thread.start so my program doesn't crash
}
However, when I write this code, if Execute throws an exception, it bubbles
to the top of the thread and then crashes the entire program. Is there a way
to catch an exception from the thread so my program doesn't crash? Thanks