Reputation: 7197
I am using windows forms application, which runs from system tray. In ContextMenuStrip I have an Exit icon, which should be terminating my process, but it doesn't.
My process stays in task manager. So, if I run (and terminate) the applicaiton several times, then I have several processes in task manager, although none of them is reachable any more.
My code for exiting application is simple:
void exitOnClick(object sender, System.EventArgs e)
{
_notifyIcon.Visible = false;
Application.Exit();
}
I've checked with debugger - this code is triggered when I press Exit. Notify icon dissapears, but process remains in task manager. Also, if any of win forms are open, they are closed.
Upvotes: 0
Views: 1057
Reputation: 14059
Try to use Environment.Exit static method. This method:
... terminates an application immediately, even if other threads are running.
But it's better to find a code that is still running, as you was told above.
Upvotes: 2