ThreadAbort exception when breaking into a BackgroundWorker thread
-
Hi everyone, I'm stumped. I am trying to debug a .net UI application that kicks off a background worker thread. I set a breakpoint in the worker method for the BGW thread and it breaks successfully (albeit after a 10 second hang), but as soon as I try to step through the app it crashes with a "A first chance exception of type 'System.Threading.ThreadAbortException' occurred in System.Windows.Forms.dll" message. It doesn't seem to matter where I break in the BGW thread, every time I try to do something when I'm in there the app crashes. I'm pretty sure I debugged this successfully when I was developing the app a couple of years ago so I don't know why I'm having so much difficulty now! Has anyone else seen this behavior? Regards, Chris Chambers.
-
Hi everyone, I'm stumped. I am trying to debug a .net UI application that kicks off a background worker thread. I set a breakpoint in the worker method for the BGW thread and it breaks successfully (albeit after a 10 second hang), but as soon as I try to step through the app it crashes with a "A first chance exception of type 'System.Threading.ThreadAbortException' occurred in System.Windows.Forms.dll" message. It doesn't seem to matter where I break in the BGW thread, every time I try to do something when I'm in there the app crashes. I'm pretty sure I debugged this successfully when I was developing the app a couple of years ago so I don't know why I'm having so much difficulty now! Has anyone else seen this behavior? Regards, Chris Chambers.
Is your worker thread directly accessing any UI elements?
chambers-chris wrote:
it breaks successfully (albeit after a 10 second hang)
I would break execution during that hang and see why that's happening first.
chambers-chris wrote:
exception of type 'System.Threading.ThreadAbortException' occurred
Any useful info in the exception object?
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Is your worker thread directly accessing any UI elements?
chambers-chris wrote:
it breaks successfully (albeit after a 10 second hang)
I would break execution during that hang and see why that's happening first.
chambers-chris wrote:
exception of type 'System.Threading.ThreadAbortException' occurred
Any useful info in the exception object?
Mark Salsbery Microsoft MVP - Visual C++ :java:
Hi Mark, It does access UI elements, but it always does it via Invokes, i.e.
this.Invoke(new SetActionLabelCallBack(SetActionLabel), "Writing Program Memory");
Also, I don't think I was very clear about the 10 second hang. I mean when execution breaks there's a 10 second hang in visual studio before I can do anything like inspect values or step through code. I will change my exceptions to break on ThreadAbortExceptions to see if there's any useful info. Good thinking. Cheers! -
Hi everyone, I'm stumped. I am trying to debug a .net UI application that kicks off a background worker thread. I set a breakpoint in the worker method for the BGW thread and it breaks successfully (albeit after a 10 second hang), but as soon as I try to step through the app it crashes with a "A first chance exception of type 'System.Threading.ThreadAbortException' occurred in System.Windows.Forms.dll" message. It doesn't seem to matter where I break in the BGW thread, every time I try to do something when I'm in there the app crashes. I'm pretty sure I debugged this successfully when I was developing the app a couple of years ago so I don't know why I'm having so much difficulty now! Has anyone else seen this behavior? Regards, Chris Chambers.
I have the same problem and I finally found an explanation here http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/8cbfb45a-4cc2-4604-abda-f892635f7833[^] And some other usefull info here : http://blogs.msdn.com/greggm/archive/2005/11/18/494648.aspx[^] Hope it will help you