|
-
April 13th, 1999, 06:16 PM
#1
What's a "First-chance exception"?
Hi,
I'm using the CMemoryState class to help detect memory leaks, and when running my app in debug mode using F5, the debug window occasionally says something like:
"First-chance exception in SynClient.exe (KERNEL32.DLL): 0xC0000005: Access Violation."
Is this actally an error? I don't actually get a normal Access Violation, so what does it mean? Is it something I should worry about and try and fix?
And if so, how I go about working out what causes it?
Thanks!
Nick......
-
March 13th, 2005, 06:06 PM
#2
Re: What's a "First-chance exception"?
Usually, when I get that error, code is closing a Windows handle that has already been closed; in that case, the error is not fatal, and I perform the following steps to avoid confrontation:
- Open the "Exceptions" menu item from the "Debug" menu and change the action for an "Invalid Handle" to "Stop if not handled."
-
March 13th, 2005, 06:47 PM
#3
Re: What's a "First-chance exception"?
If the exceptions are being handled then you shouldn't normally have a problem. However you should try your best to track down what's causing the exception (usually because you're doing something wrong I might add) and fix it.
There are loads of first chance exceptions which get thrown and handled in the WMV replay code - from what I've seen - but I've not seen any adverse effects from them.
Just be aware that it's very likely that you're doing something wrong in your code and you should try to find out what. Especially with access violation exceptions which can have potentially deadly consequences.
Darwen.
-
March 14th, 2005, 02:38 AM
#4
Re: What's a "First-chance exception"?
If the OS encounters an exception when running your app (well, certain types of exception anyway) it gives your application the "first chance" at handling it. If your app doesn't handle the exception, it gets passed back to the OS to see if something else will handle it.
In my experience, first chance exceptions are rarely caused by your program. They can be caused by your program calling a DLL function which encounters an exception. Your program gets 'first chance' but it wasn't expecting the exception so it doesn't handle it. The exception then gets passed back to the DLL which possibly does handle it. Otherwise, the OS might be offered a chance to handle it. If nothing handles the exception at all, you'll get the dreaded "Unhandled Exception" message box.
Any exceptions caused by your program will generally result in the dreaded message box - because it's quite unlikely that they'll be handled by anything else.
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
July 4th, 2012, 09:40 AM
#5
Re: What's a "First-chance exception"?
list<Pnt*>::iterator start =hex_cplist_combine->PntList_xy.begin();
list<Pnt *>::iterator end ;
for(start; start !=hex_cplist_combine->PntList_xy.end()
{
//FreePntArr();
g_ObjRecSetup.mappingsetup.CartStarter.x = (*start)->x;
g_ObjRecSetup.mappingsetup.CartStarter.y = (*start)->y;
end=hex_cplist_combine->PntList_xy.begin();
//for(end; end !=cart_cplist->PntList_xy.end()
for(end; end !=hex_cplist_combine->PntList_xy.end()
{
Curve * pPolarPath, * pCartPath;
pPolarPath = newCurve();
pCartPath = newCurve();
try
{
g_ObjRecSetup.mappingsetup.CartEnd.x= (*end)->x;
g_ObjRecSetup.mappingsetup.CartEnd.y = (*end)->y;
}
catch (exception& e)
{
AddReportData(0,"exception caught:%s",e.what());
}
display();
end++;
}
start++;
}
Above is the part of my code.I keep getting first chance exception at the line highlighted in bold.My code also crashes and I cant figure out why?The list does have values and nothing is null as far as I checked.
Thanks
Shweta
-
July 4th, 2012, 09:48 AM
#6
Re: What's a "First-chance exception"?
Instead of resurrecting a thread that's 7 years old (13 years from the original post) you should start a new thread with your problem.
Be sure to rate those who help!
-------------------------------------------------------------
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|