Reputation: 2771
What is the best way to catch Exceptions occured in BackgroundWorker in main application thread. I have intensive UPD operations being processed in BackgroundWorker, but when exception occurs, my main application can not log what happened. Please recommend the best practices.
Thanks
Upvotes: 1
Views: 681
Reputation: 124706
You should handle the RunWorkerCompleted
event, which will be fired on your main application thread.
RunWorkerCompletedEventArgs.Error
will contain the exception, or will be null if there was no exception.
Upvotes: 3