the problem statement is that, i have written my code Process.GetCurrentProcess().Kill() to kill my process while the application exits, i know it happens automatically, but my application is a relly big application, there were scenarios where the application was not exitted properly and the only way to exit was to kill the process manually from the task manager.
But, while the application hangs, there is no way my code gets executed because the above said line is executed while the exit but is clicked.
How do I kill the process through my program when my application hangs.

Thanks in advance.

If the application hangs how can it execute anything? You need to figure out what the problem is.

Thanks Momerath, this was wat I had updated my manager as well, meanwhile thought if there was any other workaround that can be done.
how does the background worker thread help with this issue ?