I have a Windows Forms application which starts a couple of background workers and has a main UI thread running a form.
This application sometimes prevents the user from logging off, restarting or shutting down.
It shows a screen like the following:
The only solution I got is subscribing to the FormClosing event of my mainform and force the closing of the program like shown in the following answer.
Following this solution I was able to terminate my program without waiting indefinitely on the screen shown above but I still get it for few seconds.
How can I prevent the windows from showing
This program is preventing Windows from (restarting/shutting down/logging off)?
I tried other answers on similar question:
- Made sure all my other threads are background threads
- Subscribed to the Form_Closing event (Partial solution, windows closes the application eventually but the message appears for a few seconds)
- Made sure no other forms are implementing Form_Closing and holding the application
