Debugging. Access Violation.

Posted on 1998-08-11
Medium Priority
Last Modified: 2013-11-20
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.
Question by:TylerRick
  • 6
  • 2
  • 2
  • +1
LVL 23

Expert Comment

ID: 1320605
You may usually ignore it. See the following KB article.

First and Second Chance Exception Handling

Author Comment

ID: 1320606
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.

Accepted Solution

Priyesh earned 240 total points
ID: 1320607
        I don't know what it will be like in VC 4.0 i am using VC5.0.. Please see if u can use "call stack " or view the stack in any debug options.. see near watch etc..  when u'r program breaks and enters debug mode.. Call stack traces down the path through which u came to the particular access violation point..  and in VC 5, when u double click on  a particular function shown in call stack window, it goes to the source file.. I love debugging.. and 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..
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


Expert Comment

ID: 1320608
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()

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.

Author Comment

ID: 1320609
Here's my call stack:
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()

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.


Author Comment

ID: 1320610

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?

Expert Comment

ID: 1320611
Sorry priyesh i didn't see your answer - i think my browser didn't show up the updated
page :)

Expert Comment

ID: 1320612
          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... :)))
LVL 23

Expert Comment

ID: 1320613
This is not directly caused by the first-chance exception. There is a bug in your program.

Author Comment

ID: 1320614
OK. I wish I could find and squash that bug.

Author Comment

ID: 1320615

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 []

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.


Author Comment

ID: 1320616
Adjusted points to 60

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…

607 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