I know, that you can handle BackgroundWorker errors in RunWorkerCompleted handler, like in next code
var worker = new BackgroundWorker();
worker.DoWork += (sender, e) =>
{
throw new InvalidOperationException("oh shiznit!");
};
worker.RunWorkerCompleted += (sender, e) =>
{
if(e.Error != null)
{
MessageBox.Show("There was an error! " + e.Error.ToString());
}
};
worker.RunWorkerAsync();
But my problem is that i still receive a message : error was unhadled in user code on line
throw new InvalidOperationException("oh shiznit!");
How can i resolve this problem ?