I am checking if the windows authenticated user is a valid user for my wpf application or not.
If not, I need to shut down the application; but even after executing
I have never had luck shutting something down from the start-up. I would suggest starting a new Thread that, after some brief delay, shuts down the application using similar code that you have in your sample.
Use Environment.Exit() instead. That will try to shut down gracefully, but if it can't gracefully, will shut down rudely -- forcefully terminating threads.