A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in WindowsBase.dll
I have a .NET 4.0 WPF project.
When I open a FileDialog, choose some files and press the OK button, then I see in the output window this error:
A first chance exception of type 'Sy开发者_如何学JAVAstem.ComponentModel.Win32Exception' occurred in WindowsBase.dll
OpenFileDialog fileDialog = new OpenFileDialog();
fileDialog.Multiselect = true;
DialogResult result = fileDialog.ShowDialog();
if (result == DialogResult.OK)
{
Why do I get that Exception before the if-statement?
It sounds like you're seeing a Win32Exception
which was raised and handled within the WPF application stack. I've seen this happen many times when debugging WPF applications. They make API calls which can fail, handle the exception and continue processing.
It's nothing to be concerned about unless the exception makes it way back to your code.
精彩评论