I’ve really read all other similar threads on Stackoverflow. Nothing works for me…
I throw an exception of type “Exception” but i can’t handle the exception.
I’ve tried it in the DoWork Progress, in the CompletedEvent (with try/catch, witch e.error….)
void bgGetResponse_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error != null)
{
MessageBox.Show(e.Error.Message);
ConvertByte(myFile);
myFile= null;
}
}
void bgGetResponse_DoWork(object sender, DoWorkEventArgs e)
{
byte[] test= new byte[] { 1, 1, 0, 1, 1};
//Here the error occured (just with throw new Exception("error"))
//The method only throws an exception (for test purposes)
testResponse= _configManager.GetResponse(test, 0);
}
GetResponse(...)
{
throw new Exception("..!");
}
Any ideas?
Thanks for your efforts
If by “can’t handle” the exception you mean can’t use
catch, that’s true. You just use the Error property. You could “throw” that in your Completed event handler; but then you stack frame will be different.e.g.: