Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

First Chance Exception message in vc++

Posted on 2006-10-31
11
Medium Priority
?
669 Views
Last Modified: 2009-12-16
why do i get the following error while running a database application:

First-chance exception in CaliberationDB.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
0
Comment
Question by:adders99
  • 4
  • 2
  • 2
8 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 672 total points
ID: 17847937
First-chance exception messages can be ignored. They are printed when some exception was thrown and catched by exception handler. This can happen both in your own code or in some libraries which are called from your code. The problem is unhandled exception, which is thrown and not catched anywhere - such exception terminates application. Catched (First Chance) exception is OK.
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 664 total points
ID: 17850646
To elaborate a bit more:

A "First-Chance-Exception" is nothing to worry about. 'First-chance exception in xxx...' just means that a function from within the 'xxx' caused an exception exception that was handled successfully inside the SEH frame that was active when the exception occurred. You can think of it being the same as if you use code like this:

long l;

__try // set up current SEH frame
{
CopyMemory ( &l, 0, sizeof ( long)); // read from 0x00000000
}
__except( EXCEPTION_EXECUTE_HANDLER) // handler for current frame
{
puts ( "We knew that this would go wrong...");
}

(Additional info: MS KB Article Q105675)

The article can be found at http://support.microsoft.com/support/kb/articles/q105/6/75.asp 

A first chance exception is called so as it is passed to a debugger before the application 'sees' it. This is done by sending a 'EXCEPTION_DEBUG_EVENT' to the debugger, which can now decide whether it is passed to the apllication to handle it or 'ignore' it (e.g. like an 'EXCEPTION_BREAKPOINT' aka 'int 3'). If the exception isn't handled, it becomes a '2nd chance' exception, the debugger 'sees' it the 2nd time and will usually terminate the program (without using a debugger, these exceptions end up at 'UnhandledExceptionFilter()' which will also signal the exception to the user with one of these 'nice' message boxes and terminate the program, also...)

In short: This message is only generated by a debugger & you can safely ignore it...
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 17856615
To add to above information:

The first chance exception is not shown when using C++ exceptions.

jkr, do you know whether these messages were suppressed by the debugger or is C++ exception based on somewhat different than SEH ?

Regards, Alex
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 48

Expert Comment

by:AlexFM
ID: 17856639
Firts chance exceptions are shown when using C++ exceptions.
0
 
LVL 39

Assisted Solution

by:itsmeandnobodyelse
itsmeandnobodyelse earned 664 total points
ID: 17857269
>>>> Firts chance exceptions are shown when using C++ exceptions.

Didn't get an output when I run that sequence with VC8:

bool invalid(vector<int>::iterator& it)
{
      try
      {
        int l;
        memcpy(&l, 0, 4);
            if (it == Buffer::invalid.end())
                  return true;
      }
      catch (...)
      {
      }
      return false;
}

In multiple projects of VC6 and VC8 I experienced 'first chance exceptions' only for code of foreign libraries like active-x controls or MFC dll .

Regards, Alex
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 17857360
I see firts-time exception running this under VC++ 8.0 debugger:

#include "stdafx.h"
#include <stdexcept>

int _tmain(int argc, _TCHAR* argv[])
{
    try
    {
        throw std::runtime_error("Test");
    }
    catch (const std::exception&)
    {
          
    }

    return 0;
}
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 17857366
One day I should learn to write "first" and not "firts" :(
0
 
LVL 86

Expert Comment

by:jkr
ID: 17859793
>>jkr, do you know whether these messages were suppressed by the debugger or is C++ exception based on
>>somewhat different than SEH ?

These are completely different mechanisms/concepts. You can translate C++ exceptions to SEH exceptions using '_set_se_translator()', though. SEH on Win32 is way closer to the system level than C++ exceptions - remeber that Win32 also supports other languages ;o)
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question