第一次机会例外 [英] A first chance exception

查看:62
本文介绍了第一次机会例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 windows xp 下完美运行的项目.

I have a project that runs perfect under windows xp.

现在我尝试在 Windows 7 下运行它,但在立即窗口下出现了很多异常.

Now I have tried to run it under Windows 7 and got there a lot of exceptions under Immediate window.

A first chance exception of type 'System.ArgumentNullException' occurred in Microsoft.VisualBasic.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in LP_Wizard.exe
A first chance exception of type 'System.ArgumentException' occurred in LP_Wizard.exe
A first chance exception of type 'System.NullReferenceException' occurred in LP_Wizard.exe
A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll
A first chance exception of type 'System.ArgumentNullException' occurred in Microsoft.VisualBasic.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in LP_Wizard.exe
A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll
A first chance exception of type 'System.ArgumentNullException' occurred in Microsoft.VisualBasic.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in LP_Wizard.exe
A first chance exception of type 'System.ArgumentNullException' occurred in Microsoft.VisualBasic.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in LP_Wizard.exe

知道 Windows 7 中的 Microsoft.VisualBasic.dll 有什么问题吗?我如何解决这个问题?

Any idea what wrong with that Microsoft.VisualBasic.dll in windows 7 and how i correct that problem ?

非常感谢您的帮助.

推荐答案

发生的事情是调试器可以在任何 catch块被击中.任何未被 catch 块处理的异常都被视为第二次机会"异常并且会正常中断.

What is happening is the debugger can "see" exceptions as soon as they are raised (hence the "first chance") before any catch block is hit. Any exception which is not handled by a catch block is considered a "second chance" exception and will break normally.

如果这些异常没有因为未处理而停止您的应用程序的运行,那么您可能没问题.大多数时候异常是由代码处理的,这不是问题.输出只是 Visual Studio,让您知道引发了异常.

If these exceptions aren't stopping the running of your application because they are unhandled then you are probably OK. Most of the time the exception is handled by code and this isn't a problem. The output is simply Visual Studio letting you know the exceptions were raised.

请参阅安全处理异常时避免第一次机会异常消息" 一些方法的问题,以减少这种情况,如果有太多可以忽略的话.

See the "Avoiding first chance exception messages when the exception is safely handled" question for some methods to reduce this if there are too many to ignore.

这篇关于第一次机会例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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