?
Solved

First-chance exception

Posted on 2005-03-28
2
Medium Priority
?
739 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
[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
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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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…
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

752 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