简体   繁体   English

第一次机会例外

[英]A first chance exception

I have a project that runs perfect under windows xp. 我有一个在Windows XP下完美运行的项目。

Now I have tried to run it under Windows 7 and got there a lot of exceptions under Immediate window. 现在,我尝试在Windows 7下运行它,并在“即时”窗口下找到了很多例外。

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

Any idea what wrong with that Microsoft.VisualBasic.dll in windows 7 and how i correct that problem ? 知道Windows 7中的Microsoft.VisualBasic.dll什么问题吗,我该如何解决该问题?

Thanks a lot for help . 非常感谢您的帮助。

If you want to pinpoint where the exceptions are occurring, you can select the Debug->Exceptions menu item, and in the dialog that appears, check the first checkbox for "Common Language Runtime Exceptions". 如果要查明异常发生的位置,可以选择“调试”->“异常”菜单项,然后在出现的对话框中选中“公共语言运行时异常”的第一个复选框。 This will make the debugger break as soon as an exception occurs instead of only breaking on unhandled exceptions. 这将使调试器在发生异常时立即中断,而不是仅在未处理的异常时中断。

This is also one reason why it is generally a bad idea to catch generic exceptions unless you are clearly logging the information caught. 这也是为什么除非明确记录捕获的信息,否则捕获通用异常通常不是一个好主意的原因之一。

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. 发生的事情是,调试器可以在遇到任何catch块之前,在引发异常后立即“查看”异常(因此是“第一次机会”)。 Any exception which is not handled by a catch block is considered a "second chance" exception and will break normally. 没有由catch块处理的任何异常都被视为“第二次机会”异常,并且将正常中断。

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. 输出只是简单的Visual Studio,让您知道引发了异常。

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. 请参阅“ 在安全处理异常时避免出现第一次机会异常消息 ”问题,以获取一些方法来减少这种问题(如果有太多可以忽略的话)。

Are your in the debugger? 您在调试器中吗? Are these exceptions your program is handling? 您的程序正在处理这些异常吗? If so you need to find a setting that tells VB to supress warning you of handled exceptions. 如果是这样,您需要找到一个告诉VB禁止警告您已处理的异常的设置。 Maybey this was set when installed on XP but not when you installed on W7. 也许是在XP上安装时设置的,但在W7上安装时没有设置。 See if this helps: 看看是否有帮助:

http://www.helixoft.com/blog/archives/24 http://www.helixoft.com/blog/archives/24

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 第一次机会例外 - A First Chance Exception 发生了'System.Data.DBConcurrencyException'类型的第一次机会异常 - A first chance exception of type 'System.Data.DBConcurrencyException' occurred System.dll中发生类型为SocketException的第一次机会异常 - A first chance exception of type SocketException occurred in System.dll 非托管的第一次机会异常会导致崩溃/重新启动吗? - Can unmanaged first chance exception cause a crash/restart? 类型“ System.InvalidCastException”的第一次机会异常发生在战斗模拟器上的Microsoft.VisualBasic.dll中 - A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll on a combat simulator Microsoft.VisualBasic.dll中发生了类型为'System.InvalidCastException'的第一次机会异常 - A first chance exception of type 'System.InvalidCastException' occured in Microsoft.VisualBasic.dll 错误:Microsoft.VisualBasic.dll中发生了类型为'System.InvalidCastException'的第一次机会异常 - Error: A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll Microsoft.VisualBasic.dll中发生了类型为'System.InvalidCastException'的第一次机会异常 - A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll System.Windows.Forms.dll 中发生类型为“System.InvalidOperationException”的第一次机会异常 - A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll mscorlib.dll中发生类型'System.InvalidCastException'的第一次机会异常 - A first chance exception of type 'System.InvalidCastException' occurred in mscorlib.dll
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM