Link to home
Start Free TrialLog in
Avatar of TylerRick
TylerRick

asked on

Debugging. Access Violation.

I keep getting this error in the Debug window:
   First-chance exception in FileNameCorrector.exe (MFC40D.DLL): 0xC0000005: Access Violation.

Can you give me more information on this? What is the cause of this? How do I track it down and fix it? How do I debug this?

I'd give more details, but I don't know where to start. It doesn't even seem to always happen at the same spot.

When it has the error, it breaks and goes into the debugger mode. But it doesn't stop in any of my functions. It stops in some assembly code which makes no sense to me.

I'm using Visual C++ 4.0.
Avatar of chensu
chensu
Flag of Canada image

You may usually ignore it. See the following KB article.

First and Second Chance Exception Handling
http://support.microsoft.com/support/kb/articles/q105/6/75.asp
Avatar of TylerRick
TylerRick

ASKER

I couldn't ignore it. When I try to resume the debugger (With Debug-Go) it simply stops and shows the same message again. I can't get past the point where it stops.

What's worse, when I execute it without the debugger, it will crash at the same spot, giving this dialog box message:
 This program has performed an illegal operation and will be shut down.
ASKER CERTIFIED SOLUTION
Avatar of Priyesh
Priyesh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
After the exception, you can view the 'call stack' (which is located in the 'View' menu),
it should show you the order of function calls leading to the exception. Usually it looks
a bit like this:

CMS951Dlg::OnSetCursor(CWnd * 0x0072f8a0 {CMS951Dlg hWnd=0x0000024c}, unsigned int 0x00000001, unsigned int 0x00000200) line 590
CWnd::OnWndMsg(unsigned int 0x00000020, unsigned int 0x0000024c, long 0x02000001, long * 0x0072f51c) line 1754 + 39 bytes
CWnd::WindowProc(unsigned int 0x00000020, unsigned int 0x0000024c, long 0x02000001) line 1617 + 30 bytes
AfxCallWndProc(CWnd * 0x0072f8a0 {CMS951Dlg hWnd=0x0000024c}, HWND__ * 0x0000024c, unsigned int 0x00000020, unsigned int 0x0000024c, long 0x02000001) line 209 + 26 bytes
AfxWndProc(HWND__ * 0x0000024c, unsigned int 0x00000020, unsigned int 0x0000024c, long 0x02000001) line 362 + 25 bytes
KERNEL32! bff73663()
KERNEL32! bff92894()
00008632()
058f64c9()

Search from the topmost line to the bottom of the stack until you find a function with
a readable name - like 'CWnd::OnSetCursor' or something like that. That should give
you a good hint what happened.
Here's my call stack:
00006469()
MFC40D! 5f825bff()
MFC40D! 5f844dae()
MFC40D! 5f8450a9()
CFileNameCorrectorDoc::AssertValid() line 73
MFC40D! 5f825d9c()
MFC40D! 5f8461e2()
MFC40D! 5f8469ae()
MFC40D! 5f825d9c()
MFC40D! 5f85bece()
MFC40D! 5f825d9c()
MFC40D! 5f83ac55()
MFC40D! 5f825d9c()
MFC40D! 5f83a3df()
MFC40D! 5f8399f4()
MFC40D! 5f83a792()
MFC40D! 5f833a9f()
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x8158fc7e, int 1) line 33 + 21 bytes
WinMainCRTStartup() line 330 + 57 bytes
KERNEL32! bff88f75()
KERNEL32! bff88e23()
KERNEL32! bff8783f()
00000004()

As you can see, most of it is MFC code. The 1st readable function is CFileNameCorrectorDoc::AssertValid(), and it doesn't tell me any thing useful.

Priyesh,

You love debugging? That's cool. I find it really annoying, mainly because I never know how to solve it. Actually, I enjoy stepping through my code, but when it's some thing vage like this, where I can't even see any code, it bugs me.

>if u are so desperate that u can't find it out, please mail me
>the source and description abt the problem.. we  shall give it >a try..
That sounds like a good idea. Let's try it. What's your e-mail address?
Sorry priyesh i didn't see your answer - i think my browser didn't show up the updated
page :)
TylerRick,
          CFileNameCorrectorDoc is u'r class..U have put the AssertValid()... please see around that..As u point out.. i too expected to see some meaningful funcion names,,, but disappointed.. it's ok.. Please mail me if u can with the source..
         my mail id is.. priyesh@mindless.com.

Snoegler.. It's ok.. seems we both were giving the answer simultaneously... :)))
           
This is not directly caused by the first-chance exception. There is a bug in your program.
OK. I wish I could find and squash that bug.
Priyesh,

I got your e-mails and responded to them, but I don't think they got to you. I got messages like this:

The original message was received at Thu, 13 Aug 1998 13:19:52 -0400 (EDT)
from lmtp03.globecomm.net [206.253.129.139]

**
This is an automatic message to inform you that your email was not
forwarded through iName's server.

The iName email address that you tried to send mail to may not be active.
Reasons for the failed delivery attempt could include:

1. The iName customer has selected a new personalized iName email address
   rendering their old iName email address inactive.

2. The iName customer may have signed up for one of iName's free offers
   and then not validated their forwarding address.

3  The address may simply be typed incorrectly.  Please check that you
   typed the email address correctly.

Adjusted points to 60