Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 88665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:35:44+00:00 2026-05-10T22:35:44+00:00

I have thread exception handler which saves the exception stack trace and should close

  • 0

I have thread exception handler which saves the exception stack trace and should close the application. I call Applicatoin.Exit, but that only closes the window, living the app running windowless.

I know, that this usually happens because some background threads are still running. I attached windbg to the windowless process and there seem to be only two managed threads, one of which looks like the gc finalizer thread, the second looks like a message pump??? Anyone understands this?

Is there a difference between calling Application.Exit and user closing the main window?

 0:005> !threads ThreadCount: 2 UnstartedThread: 0 BackgroundThread: 1 PendingThread: 0 DeadThread: 0 Hosted Runtime: no                                       PreEmptive   GC Alloc           Lock        ID OSID ThreadOBJ    State     GC       Context       Domain   Count APT Exception    0    1  284 002e9668      6020 Enabled  021a7268:021a7fe8 002e4c68     0 STA    2    2  d48 002f9890      b220 Enabled  00000000:00000000 002e4c68     0 MTA (Finalizer) 0:001> ~0 s *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\system32\MSCTF.dll -  eax=02162530 ebx=002e9668 ecx=02162530 edx=02162530 esi=0019ef9c edi=0019ee3c eip=77589a94 esp=0019edcc ebp=0019ede8 iopl=0         nv up ei pl zr na pe nc cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246 ntdll!KiFastSystemCallRet: 77589a94 c3              ret 0:000> !clrstack OS Thread Id: 0x284 (0) ESP       EIP      0019ef24 77589a94 [ComPlusMethodFrameGeneric: 0019ef24] MS.Win32.UnsafeNativeMethods+ITfMessagePump.GetMessageW(System.Windows.Interop.MSG ByRef, Int32, Int32, Int32, Boolean ByRef) 0019ef44 56d61937 System.Windows.Threading.Dispatcher.GetMessage(System.Windows.Interop.MSG ByRef, IntPtr, Int32, Int32) 0019ef90 56d617e3 System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) 0019efe0 56d616c7 System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) 0019effc 56d6162d System.Windows.Threading.Dispatcher.Run() 0019f008 5533ddb0 System.Windows.Application.RunInternal(System.Windows.Window) 0019f034 5533dbe5 System.Windows.Application.Run(System.Windows.Window) 0019f044 5533d836 System.Windows.Application.Run() 0019f04c 01ea00ad UI.App.Main() 0019f268 79e7c74b [GCFrame: 0019f268]   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:35:44+00:00Added an answer on May 10, 2026 at 10:35 pm

    I worked it out. Instead of calling System.Windows.Forms.Application.Exit() I should have called System.Windows.Application.Shutdown(). The message pump thread belongs to wpf, you can see it from the stack trace of that thread.

    In other words, System.Windows.Forms.Application.Exit() will not close WPF message pumps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 179k
  • Answers 179k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Using "this." is redundant in any class. It's totally up… May 12, 2026 at 3:46 pm
  • Editorial Team
    Editorial Team added an answer What Robert said theoretically - nothing to add. Practically, temporal… May 12, 2026 at 3:46 pm
  • Editorial Team
    Editorial Team added an answer It's made to avoid float elements to keep on floating… May 12, 2026 at 3:46 pm

Related Questions

I'm having a problem with an application hanging and giving me the default Please
I have a simple UserControl for database paging, that uses a controller to perform
I have a background worker which can be cancelled. The normal flows interrupt itself
I have a asp.net 2.0 web app which calls a long running stored proc

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.