?
Solved

First-chance exception

Posted on 2005-03-28
2
Medium Priority
?
743 Views
Last Modified: 2013-11-20
Hi

I have tracked down a first chance exception to DBCORE.CPP line
3049

AFX_ODBC_CALL(::SQLExtendedFetch(m_hstmt, wFetchType,
nRow, pdwRowsFetched, m_rgRowStatus));

Function: FetchData


The exception is only happening when I do the following

while (!rs.IsEOF())
{
      do something
      rs.MoveNext();
}

do something

rs.MoveFirst()
while (!rs.IsEOF()) {
      do something.
      rs.MoveNext();
}

The exception is

First-chance exception in Archive.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.

It only happens when move next is called to move past the EOF. in the second loop. I think
somehow this has something to do with the call to MoveFirst as the exception is never
thrown in the first loop.

Does anyone know who to get rid of this exception, or even what is causing it?

Thanks
anti

0
Comment
Question by:antinutrino
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 1000 total points
ID: 13645108
See http://support.microsoft.com/default.aspx?scid=kb;en-us;105675 ("INFO: First and Second Chance Exception Handling") and http://msdn.microsoft.com/library/en-us/debug/base/exception_handling_functions_for_debugging.asp ("Exception Handling Functions for Debugging"). The scoop is

"When an exception occurs in a process that is being debugged, the system notifies the debugger by passing the exception to it. This is known as first-chance notification. The system then suspends all threads in the process being debugged.

If the debugger does not handle the exception, the system attempts to locate an appropriate exception handler. If the system cannot locate an appropriate one, the system again notifies the debugger that an exception has occurred. This is known as last-chance notification. If the debugger does not handle the exception after the last-chance notification, the system terminates the process being debugged."

In other words, a "First-chance exception" means that an exception was successfully handled by the application. You can think of it as

long l;

__try // set up 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...");
}

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 application to handle it or 'ignore' it (e.g. like an 'EXCEPTION_BREAKPOINT' aka 'int 3')

In short: You can safely ignore it.
0
 

Author Comment

by:antinutrino
ID: 13767772
Thanks for the answer. sorry about the delay,

cheers
anti
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Suggested Courses

569 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