Share via


How Can I Debug an Access Violation?

Full Problem Description: 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: setting 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 .