c# - Why is BackgroundWorker exception not handled? -
this code throws exception. in class called githelper
called class gitprogressdialog
it's bw_dowork
method.
public class githelper { .... if (!run(commands[i])) { var e = new invalidoperationexception(error); e.data["stepindex"] = i; throw e; } ...
this code handling exceptions:
public partial class gitprogressdialog : form { ... private void bw_runworkercompleted(object sender, runworkercompletedeventargs e) { if (e.cancelled == true) { } else if (e.error != null) { success = false; errorstepindex = (int)e.error.data["stepindex"]; seterror(e.error.message); } else { success = true; this.close(); } }
error happening in line:
errorstepindex = (int)e.error.data["stepindex"];
system.nullreferenceexception object reference not set instance of object.
i guess data not set well? why? works me withing visual studio , without debugger. client activates main exception handling routine logs , closes app.
Comments
Post a Comment