How can I debug an unhandled exception in code called from BackgroundWorker?

I run some import code asynchronously from a simple WinForms application using the object BackgroundWorkerand its method DoAsync(). I had a problem when I did not know that exceptions were excluded and the thread was prematurely dying. I eventually discovered this and now know when the exception is thrown after reading the Unhandled exceptions in BackgroundWorker .

However, during debugging, I still have a problem. How do I debug this code? I suppose I can run it in a test application that does not use BackgrounWorker, but is there any way to debug this as it is? If I go through the code that actually throws the exception, I just go out step by step when the exception occurs. Naturally, throwing an exception again RunWorkerCompletedEventHandlerdoes not help either.

Any ideas !? Thanks in advance!

+3
source share
2 answers

"Break On Exceptions" VS (Ctrl + Alt + E Debug- > Exceptions "" )? , - .

+6

Source: https://habr.com/ru/post/1736718/


All Articles