Solved

First Chance Exception message in vc++

Posted on 2006-10-31
11
664 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
11 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 168 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 166 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 166 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Which Linux flavors will this run on? 6 102
How to remove Recent Projects from Embarcadero C++ builder XE10. Berlin 2 78
Gaming Software 1 29
I could not set window to top 4 42
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

756 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