Application.Exit() not working very well
-
Hi, I was trying to close my application but it doesn't work as the Task Manager still showing that it is running. I'd search around the Internet and tried Environment.Exit(-1), Thread.CurrentThread.Abort() but nothing works. Any idea? Thanks in advance. Jie Liang
-
Hi, I was trying to close my application but it doesn't work as the Task Manager still showing that it is running. I'd search around the Internet and tried Environment.Exit(-1), Thread.CurrentThread.Abort() but nothing works. Any idea? Thanks in advance. Jie Liang
Hello If your application is multithreaded -which I suspect-, Probably one of your foreground threads is still running. Either keep track of your threads and abort them on exit -or end them more gracefully if possible-, or set them to background threads so that they exit themselves upon the program termination.
Regards:rose:
-
Hello If your application is multithreaded -which I suspect-, Probably one of your foreground threads is still running. Either keep track of your threads and abort them on exit -or end them more gracefully if possible-, or set them to background threads so that they exit themselves upon the program termination.
Regards:rose:
-
Hi, I was trying to close my application but it doesn't work as the Task Manager still showing that it is running. I'd search around the Internet and tried Environment.Exit(-1), Thread.CurrentThread.Abort() but nothing works. Any idea? Thanks in advance. Jie Liang
Well depends on the CLR. when main returns, main still is the primary thread, but a manged thread. It will depend on whims n fancies of the CLR. CLR will take some time to reflect the thread stoppage, depending on other work it is involved in. So no need to be worried.
Excelsior Arjun Bahree "By The Might of Mjolnir" I Came! I Coded! I Conquered!