I use a third-party WinForms input dialog in my WPF application, and for some reason this leads to my WPF application not closing correctly when debugging.
If I exit the winforms login dialog before logging in, the application will close correctly, however, if I log in and start the WPF window, exiting the window does not exit the application.
I set a breakpoint in the OnExit App method and never OnExit called. I OnClosing method of my main window and calls the call, but even the call to Application.Current.ShutDown() does not exit the application correctly. I also tried OnExplicitShutdown ShutdownMode application to OnExplicitShutdown and OnMainWindowClose , and none of them closed it.
The only hint I have is that the next window appears in the Debug window, but I have no idea what it is trying to tell me.
The thread 'vshost.RunParkingWindow' (0xf74) has exited with code 0 (0x0). The thread <No Name> (0x1b58) has exited with code 0 (0x0).
This behavior only occurs when working in debug mode in Visual Studio. Running the application without debugging closes the application correctly.
Can someone point me in the right direction as to what might cause this behavior?
Edit
The WinForms login dialog is not a traditional login dialog using the Show() or Close() method, it is a static class that only has the Login() and Logout() method.
Something like this is used:
if (CompanyNamespace.ApplicationName.Login()) { var shell = new ShellView(); var context = new ShellViewModel(); shell.DataContext = context; shell.Show();
source share