Bart Friederichs
Bart Friederichs

Reputation: 33491

Application doesn't quit

I have a large application with an explicit Application.Exit() call after a confirmation dialog. However, if I debug that application and I quit, the application doesn't close. Visual Studio still says "Running". All windows are closed.

Is there a way to find out what part of the application is still running or blocking something? I tried "Break All", but it didn't give me any useful info. Also, I have only one process and no threads.

Upvotes: 0

Views: 86

Answers (2)

Bart Friederichs
Bart Friederichs

Reputation: 33491

I found the issue, it was an unclosed database connection. I added SyncNotification=true to the connection string, and apparently this also means the connection needs to be closed explicitly.

So, for future visitors: as other people have mentioned: check the threads, but also any connections or other possibly blocking objects.

Upvotes: 1

Alex
Alex

Reputation: 21766

According to the documentation Application.Exit informs all message pumps that they must terminate, and then closes all application windows after the messages have been processed. Is any code still running in the UI thread ?

Upvotes: 0

Related Questions