第一个机会异常类型的“System.ComponentModel.Win32Exception”在WindowsBase.dll发生 [英] A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in WindowsBase.dll

查看:1608
本文介绍了第一个机会异常类型的“System.ComponentModel.Win32Exception”在WindowsBase.dll发生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.NET 4.0的WPF项目。

I have a .NET 4.0 WPF project.

当我打开一个FileDialog的,选择一些文件和preSS确定按钮,然后我在输出窗口看到以下错误:

When I open a FileDialog, choose some files and press the OK button, then I see in the output window this error:

有一个第一次机会异常的类型'System.ComponentModel.Win32Exception的在WindowsBase.dll发生

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)
            {

为什么我得到了异常的if语句之前?

Why do I get that Exception before the if-statement?

推荐答案

这听起来像你看到一个 Win32Exception 这是提高和WPF应用程序堆栈中进行处理。我见过调试WPF应用程序时,这种情况发生了很多次。他们让其中可以失败,处理这个异常并继续处理API调用。

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.

这是没有什么可担心,除非例外,使得它的方式回到你的code。

It's nothing to be concerned about unless the exception makes it way back to your code.

这篇关于第一个机会异常类型的“System.ComponentModel.Win32Exception”在WindowsBase.dll发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆