A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in WindowsBase.dll

纵然是瞬间 提交于 2019-12-10 14:26:35

问题


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 'System.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?


回答1:


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.



来源:https://stackoverflow.com/questions/6283804/a-first-chance-exception-of-type-system-componentmodel-win32exception-occurred

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!