Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

How Can I Debug an Access Violation?

This topic applies to:

Edition

Visual Basic

C#

F#

C++

Web Developer

Express

Topic does not applyTopic does not applyTopic does not apply

Native only

Topic does not apply

Pro, Premium, and Ultimate

Topic does not applyTopic does not applyTopic does not apply

Native only

Topic does not apply

My program produces an access violation. How can I debug this?

Use the Call Stack window to work your way back up the call stack, looking for corrupted data being passed as a parameter to a function. If that fails, try setting a breakpoint at a point before the location where the access violation occurs. Check to see if data is good at that point. If so, try stepping your way toward the location where the access violation occurred. If you can identify a single action, such as a menu command that led to the access violation, you can try another technique: set a breakpoint between the action (in this example, the menu command) and the access violation. You can then look at the state of your program during the moments leading up to the access violation.

You can use a combination of these techniques to work forward and backward until you have isolated the location where the access violation occurred. For more information, see Using the Call Stack Window.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.