First Chance Exception

简介:

When you run DX program in debug mode and enable debug setttings in DX control panel, you may get the First Chance Exceptions, like the following:

First-chance exception at 0x75ac9617 in Sura.exe: Microsoft C++ exception: long at memory location 0x0021f1d8..
Direct3D9: (ERROR) :SetLight failed.

Direct3D9: (ERROR) :Invalid D3DLIGHT range

First-chance exception at 0x75ac9617 in Sura.exe: Microsoft C++ exception: long at memory location 0x0021f1d8..
Direct3D9: (ERROR) :SetLight failed.

 

here is the explanation about First Chance Exception, original page:http://blogs.msdn.com/davidklinems/archive/2005/07/12/438061.aspx

What is a First Chance Exception?

Have you ever been debugging an application and seen a message, in the output window, about a "First chance" exception?
Ever wondered:
  • What is a first chance exception?
  • Does a first chance exception mean there is a problem in my code?

What is a first chance exception?
When an application is being debugged, the debugger gets notified whenever an exception is encountered  At this point, the application is suspended and the debugger decides how to handle the exception. The first pass through this mechanism is called a "first chance" exception. Depending on the debugger's configuration, it will either resume the application and pass the exception on or it will leave the application suspended and enter debug mode. If the application handles the exception, it continues to run normally.
In Visual Studio, you may see a message in the output window that looks like this:
A first chance exception of type 'System.ApplicationException' occurred in myapp.exe
In Visual Studio 2005 Beta2, you will see this message anytime a first chance exception is encountered in your application's code.  If you are using Visual Studio .NET 2003, this message is shown if you have configured the debugger to stop when the specific exception type is thrown.
If the application does not handle the exception, the debugger is re-notified. This is known as a "second chance" exception. The debugger again suspends the application and determines how to handle this exception. Typically, debuggers are configured to stop on second chance (unhandled) exceptions and debug mode is entered, allowing you to debug. 
Does a first chance exception mean there is a problem in my code?
First chance exception messages most often do not mean there is a problem in the code. For applications / components which handle exceptions gracefully, first chance exception messages let the developer know that an exceptional situation was encountered and was handled.
For code without exception handling, the debugger will receive a second chance exception notification and will stop with a unhandled exception. 
Take care!
-- DK


本文转自zdd博客园博客,原文链接:http://www.cnblogs.com/graphics/archive/2010/05/18/1738445.html,如需转载请自行联系原作者

相关文章
|
10月前
|
存储 前端开发 Java
Exception 和 Error
Exception 和 Error
63 0
|
11月前
|
Java API Spring
RuntimeException和Exception的区别
RuntimeException和Exception的区别
98 0
|
Java 程序员 编译器
异常(Exception)
异常(Exception)
76 0
异常(Exception)
|
安全 Java 数据库连接
Java中的异常处理详解(try、catch、finally、throw、throws)
Java中的异常处理详解(try、catch、finally、throw、throws)
256 1
|
Java 编译器 API
RuntimeException和Exception比较
RuntimeException和Exception比较
466 0
|
Linux C# Windows
【C#】简单解决PathTooLong的Exception
原文:【C#】简单解决PathTooLong的Exception 前提 windows系统路径的最大长度限制是260个字符(听说.Net 4.6.2,取消了这个限制),而Linux或者Unix系统的好像是4K个字符。
967 0
|
Java
throws 与 throw
/* * 有些时候,我们是可以对异常进行处理的,但是又有些时候,我们根本就没有权限去处理某个异常。 * 或者说,我处理不了,我就不处理了。 * 为了解决出错问题,Java针对这种情况,就提供了另一种处理方案:抛出。
1052 0