Background worker exception handling

前端 未结 3 2072
天命终不由人
天命终不由人 2020-12-17 19:56

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

3条回答
  •  清歌不尽
    2020-12-17 20:20

    Try this

    void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
    
            if (e.Error != null)
               throw new Exception("My Custom Error Message", e.Error);
    

提交回复
热议问题