VFP: C0000005 Errors and how to Troubleshoot them


You are running Visual FoxPro (VFP) interactive development environment or a custom VFP executable. The application closes and reports this error:

C0000005 Fatal exception


A C0000005 error is memory error. Specifically, a C0000005 error is an access violation error caused by a buffer overrun. For a complete discussion of this error, see this blog post: What is a C0000005 crash?


Many scenarios may cause VFP to report a C0000005 error. The most efficient method of determining the root cause is to get a memory dump on the VFP process when the error occurs and then examine the stack for the faulting module. For example, if a printer driver module is on the top of the stack, one should try updating the printer driver or trying a different driver. If a third-party OCX appears as the faulting module, then you should check with the developer of that control for an update on compatibility with your version of VFP. 

Since VFP is a 32-bit application you must use a 32-bit debugger to obtain a memory dump.

To obtain the latest version of debug diag, see this article
2580960 Debug Diagnostics Tool v1.2 is now available

These are some generic instructions for obraining a memory dump for a VFP process.

Install it on the machine(s) experiencing the crashes. Simply double click DebugDiag.msi and follow the setup wizard. Install DebugDiag to a hard drive with at least 200 megs free.

To configure DebugDiag:

  1. Open DebugDiag. The "Select Rule Type" dialog should open. Select CRASH and then click next.
  2. On the "Select Target Type" dialog, select "A specific process" and then click "Next".
  3. Type the name of your .EXE into the "Selected Process" textbox or select it from the list. If typing it in, be careful to spell the .EXE name correctly. Do NOT check the "This process instance only" box - we want the rule in affect for all instances, until we capture a dump. Click "Next" when done.
  4. On the "Advanced Configuration" dialog, set the "Maximum Userdump Limit" to 25, then click the "Exceptions" button.
  5. Click "Add Exception"
  6. Select C0000005 in the list, then set the "Action Type" to "Full Userdump" and the "Action Limit" to 25
  7. Click "OK", then "Save and Close" and finally click "Next"
  8. On the next screen, please leave the rule name and path to store the dumps as-is, then click "Next".
  9. On the "Rule Complete" screen, select "Activate the rule now" and click FINISH.

Now when a crash occurs in the application DebugDiag should automatically create dump files. The Userdump Count will also be incremented inside the DebugDiag IDE each time a dump for this rule is created. NOTE: It is not necessary to keep the DebugDiag window open; the dump monitor actually runs as a service and will capture the dump even if DebugDiag is closed.

Once the crash collection is complete, you can disable the rule we made earlier by doing this:
  1. Open DebugDiag.
  2. n the RULES tab, highlight our rule and then right-click and select "DISABLE RULE"

More Information

This MSDN article discusses the use of Debug Diag in more detail:

How to Use the Debug Diagnostic Tool v1.1 (DebugDiag) to Debug User Mode Processes