I have a WPF application with a close button which calls Application.Shutdown() to close the application. The window closes, but the app keeps running. It is clearly visible in Visual Studio that something is going on, but pausing doesn't work anymore.
I have seen similar questions on here which led me to try some other solutions. I have tried all the options for ShutdownMode in App.xaml but none of them seemed to make a difference. Same with Environment.Exit().
The obvious cause would be that a thread is still running but I can't find any such threads.
I finally resorted to a very unelegant method, in App.xaml:
protected override void OnExit(ExitEventArgs e) { base.OnExit(e); Process proc = System.Diagnostics.Process.GetCurrentProcess(); proc.Kill(); } This actually works, the application close immediately, but I wonder if this might cause any problems somewhere along the line.
Close()) is enough to close the app. I don't think we'll able to help you without more information though