I am slightly confused on how to deal with an exception.
I have a background worker thread that runs some long running process. My understanding is if an exception o
If this is the case is there any point in putting a try catch block around the bgWorker.RunWorkerAsync(); call, I assume not?
No you can't do this because bgWorker.RunWorkerAsync(); it's a method (not an event).
f you are running under the Visual Studio debugger, the debugger will break at the point in the DoWork event handler where the unhandled exception was raised.
So you can do something like this
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
try
{
//put your break point here
// here you can capture your exception
}
catch (Exception ex)
{
// here catch your exception and decide what to do
throw;
}
}