Practical guide Visual Studio C++
Analyze a crash dump in Visual Studio
A crash dump records the state of a program at the moment it crashed: the threads, their call stacks, and, in a full dump, all the memory. With the matching symbols, Visual Studio shows it as if the debugger had stopped on the crash.
Visual Studio property-page paths describe MSBuild projects. For CMake, configure the corresponding target or preset. Menu names can vary by Visual Studio version; use the cited reference for your toolset.
Transcript
A crash dump from a user, opened and explained by CppPilot in Visual Studio. Orders crashed on a user's machine, and its crash handler wrote orders.dmp.
Choose Extensions > CppPilot > Analyze Crash Dump. Give the dump file, and the folder with the .pdb files of this exact build: the symbols.
Click Analyze. CppPilot opens the dump in the native debugger with these symbols: Visual Studio shows the crash line, and the AI reads the call stack and the local variables.
The cause: ItemsToShip read lastOrder, which is null for Grace, a customer without an order. The analysis proposes a check, and changes nothing until you ask for the fix.
CppPilot explains and fixes C++ build errors in Visual Studio.
- CaptureCrash dump (.dmp)
- MatchSymbols from that build (.pdb)
- InspectException, stack, locals
The dump captures the program state. Matching symbols translate the recorded addresses into the source locations and variables you can inspect.
Create a dump
- Automatically on every crash: create the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps, withDumpFolder(the folder) andDumpType= 2 for full dumps. Windows then writes a dump each time a program crashes. - From a running or hung program: in Task Manager, right-click the process and choose Create memory dump file.
- While debugging: Debug > Save Dump As.
Keep the symbols
A dump without symbols shows only addresses. Keep the .pdb files of every build you ship, including
Release (Linker > Debugging > Generate Debug Info): the symbols must come from the exact build that
crashed. For Windows DLLs, enable the Microsoft Symbol Servers in Tools > Options > Debugging >
Symbols.
- Build AApp.exe + App.pdb
- Run ACapture crash.dmp
- Inspect ADump + matching App.pdb
A similarly named PDB from a later rebuild is not a substitute for the symbols of the crashed executable.
Open it
Choose File > Open > File and select the .dmp file. The Dump Summary shows the
exception and the modules; choose Set symbol paths to add the folder of your .pdb files,
then Debug with Native Only. Visual Studio stops on the crash: the Call Stack, Locals, and Watch windows
work as during debugging.
Read the exception code
0xC0000005, access violation: a null, dangling, or out-of-range pointer. The address read or written is in the message; near0x0, it is a null pointer.0xC00000FD, stack overflow: usually an unbounded recursion, visible as a repeated call stack.0xC0000374, heap corruption: memory written past its end or freed twice, often long before the crash.0xC0000409, stack buffer overrun or fail fast: a buffer overflow detected by/GS, or a call toabortorstd::terminate.
In Release builds, some variables are shown as optimized away: look at the caller's frame, or at the registers.
Illustrative debugger snapshot
Exception: 0xC0000005Operation: read at address 0x00000000Frame: ReadValue(int* value)Locals: value = nullptrSource at the stopped location
int ReadValue(int* value) { return *value; // Null pointer dereference}Analyze the dump with CppPilot
Choose Extensions > CppPilot > Analyze Crash Dump..., pick the .dmp file and the
folders of the .pdb files. CppPilot opens the dump with these symbols, reads the exception, the call stack,
the arguments, and the local variables, then asks the selected AI for a likely cause and a proposed correction.
Sources and scope
Official references
These links document the compiler, build system, or debugger behavior discussed here. Use the version selector on Microsoft Learn for your toolset. Example blocks are focused excerpts; required headers and build settings are stated alongside them.
Using CppPilot in Visual Studio
CppPilot connects your own Codex or Claude account to Visual Studio. If you have neither, CppPilot Cloud provides AI access for build fixes, reviews, crash analysis, and project checks. AI chat requires your own Codex or Claude account.