SaveFileDialog silently crashes WinForms app on WindowsXP
I'm developing WinForms app using C#, .NET 4.0, and DevExpress components.
On Windows 7 everything is working just fine.
On Windows XP SP3, few seconds after SaveFileDialog is shown and closed, application will silently exit.
There is no unhandled exception, Application开发者_运维百科 exit event will not fire, I'm only getting message in the Visual Studio Output window:
The program '[3164] MyApp.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
Code that is causing this issue is very simple:
saveFileDialog1.ShowDialog();
Do you have any ideas why is this happening? How can I troubleshoot and fix this?
Enable unmanaged debugging in the project properties window. And ensure that Visual Studio is set to break on all exceptions (check the "Throw" option in the Debug\Exceptions menu).
Then run your application again. VS should now break on the exception - it should be a shell extension or file handler that's causing your app to fail.
You can try to call your SaveFileDialog
in a new Thread, and tell us if it works.
You can have A first chance exception of type 'System.Threading.ThreadAbortException' occurred in System.Windows.Forms.dll
, and that will crash your application.
I think this happens because the current Thread is not suitable for running a SaveFileDialog
.
Advice: review if you're dealing with threads (in order to correct some), and try to launch a new Thread to start the desired file dialog.
精彩评论