locked
first chance exception of type 'System.Threading.ThreadAbortException' RRS feed

  • Question

  • Been following this "C# 2D Game Tutorial 2 - Creating the Graphics Engine" the URL - https://www.youtube.com/watch?v=A_2OfHQgEUk

    When I close the form I get from the console:

    A first chance exception of type 'System.Threading.ThreadAbortException' occurred in System.Drawing.dll
    An exception of type 'System.Threading.ThreadAbortException' occurred in System.Drawing.dll but was not handled in user code
    The thread '<No Name>' (0x1c18) has exited with code 0 (0x0).
    A first chance exception of type 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll
    A first chance exception of type 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll

    ......

    'side_scroller_game.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    The thread '<Thread Ended>' (0x3554) has exited with code 0 (0x0).

    • Moved by CoolDadTx Tuesday, January 12, 2016 3:52 PM Winforms related
    Tuesday, January 12, 2016 1:11 PM

Answers

  • You just closed the form.

    That's going to abort any threads it has going.

    If you want to avoid seeing those "errors" then devise some way of stopping those threads on window closing.

    Otherwise.

    You could just ignore them.

    By Console, you mean Output window?

    It's fairly common to see errors which are of no significance in the output window.


    Hope that helps.

    Technet articles: WPF: Layout Lab; All my Technet Articles

    Tuesday, January 12, 2016 3:16 PM
  • Sounds like you closed your form while you have background work being done such as timers or async calls. When the form closed it terminated the threads which trigger the exception. The exception itself is harmless (web apps generate it all the time) but in a well-formed Winforms app you shouldn't see it. I recommend that you handle the OnFormClosing or OnFormClosed and stop/clean up any background work that you're doing. This should eliminate the issue.

    Michael Taylor
    http://blogs.msmvps.com/p3net

    Tuesday, January 12, 2016 3:51 PM

All replies

  • Maybe if you post some code we can help you


    Hope it helps. Spiri

    Tuesday, January 12, 2016 2:53 PM
  • You just closed the form.

    That's going to abort any threads it has going.

    If you want to avoid seeing those "errors" then devise some way of stopping those threads on window closing.

    Otherwise.

    You could just ignore them.

    By Console, you mean Output window?

    It's fairly common to see errors which are of no significance in the output window.


    Hope that helps.

    Technet articles: WPF: Layout Lab; All my Technet Articles

    Tuesday, January 12, 2016 3:16 PM
  • Sounds like you closed your form while you have background work being done such as timers or async calls. When the form closed it terminated the threads which trigger the exception. The exception itself is harmless (web apps generate it all the time) but in a well-formed Winforms app you shouldn't see it. I recommend that you handle the OnFormClosing or OnFormClosed and stop/clean up any background work that you're doing. This should eliminate the issue.

    Michael Taylor
    http://blogs.msmvps.com/p3net

    Tuesday, January 12, 2016 3:51 PM