Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

First Chance Exception message in vc++

Posted on 2006-10-31
11
Medium Priority
?
668 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 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
Independent Software Vendors: 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

721 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