Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save randyburden/3e0d6a10699ba1b43029eacc66bfd504 to your computer and use it in GitHub Desktop.
Save randyburden/3e0d6a10699ba1b43029eacc66bfd504 to your computer and use it in GitHub Desktop.
How to Capture a Memory Dump for a Specific Process using ProcDump and Debug with Visual Studio - Tested and works with .NET Core Apps

How to Capture a Memory Dump for a Specific Process using ProcDump and Debug with Visual Studio

  • Download ProcDump

  • Run this command file in an Administrator Console to capture a one-time memory dump for a specific processes:

    • procdump.exe YourProcessName -accepteula -ma C:\MemoryDumps\Dumps
      • Note, just use the name of the process that is displayed in the Task Manager
  • To view a captured dump:

    • Copy the dump file to your machine
      • Zip or 7-Zip the file before transferring to your machine as the files are very large
        • Also, consider uploading the file via OneDrive / Google Drive as a faster way to copy the file to your machine
    • In Visual Studio, be sure you have reverted your code back to the same version of the app that is being debugged/analyzed and re-build the solution in release mode
      • Be sure to place the re-built binaries in the exact same directory on your machine so that Visual Studio can find the .pdb files
    • In Visual Studio, open the .dmp file and click "Debug with Managed Only"
      • If a "Just My Code Warning" dialog opens, select "Disable Just My Code and Continue"
      • If a Stack Overflow error occurred, it will immediately breakpoint on the exact line that caused the Stack Overflow
      • By debugging the memory dump, you can see all active threads, double click on any thread to see the code and all variables loaded
@randyburden
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment