Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. ThreadAbort exception when breaking into a BackgroundWorker thread

ThreadAbort exception when breaking into a BackgroundWorker thread

Scheduled Pinned Locked Moved Visual Studio
debuggingcsharpdesignquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheIdleProgrammer
    wrote on last edited by
    #1

    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.

    M E 2 Replies Last reply
    0
    • T TheIdleProgrammer

      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.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      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:

      T 1 Reply Last reply
      0
      • M Mark Salsbery

        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:

        T Offline
        T Offline
        TheIdleProgrammer
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        • T TheIdleProgrammer

          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.

          E Offline
          E Offline
          Erakis
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups