Skip to content

Instantly share code, notes, and snippets.

@dungpa
Last active October 21, 2017 00:55
Show Gist options
  • Save dungpa/20516eea23374df22ff47b5810f52647 to your computer and use it in GitHub Desktop.
Save dungpa/20516eea23374df22ff47b5810f52647 to your computer and use it in GitHub Desktop.
7th trick

Create a 64-bit version of PerfView for bigger memory space

copy PerfView.exe PerfView64.exe
src\tools\corflags /32bitPref- PerfView64.exe

Reference microsoft/perfview#175 (comment)

Debug StackOverflow exceptions

  • Run devenv /debugexe foo.exe args
  • From an admin command prompt and tick "CLR exceptions" in the "Debug --> Exceptions" dialog. This will stop at the SO and give you a stack trace

Courtersy dotnet/fsharp#2893 (comment)

Debug exceptions from Visual Studio

  • Compile the code and run the main executable inside VS
  • Open another VS instance, attach the previous instance to it
  • Try to crash the application running inside VS, the other instance will show the stacktraces and where the exceptions occur.

Watson full dumps

ou can ask Watson to collect full dumps and save them locally by setting some reg keys. See http://msdn.microsoft.com/en-us/library/windows/desktop/bb513638(v=vs.85).aspx.

I think if you set:

  • HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\devenv.exe\DumpFolder to a folder on your machine,
  • HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\devenv.exe\DumpCount to the list of dumps to keep
  • HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\devenv.exe\DumpType to a Dword with the value 2 to keep full dumps.

You should see a full dump appear the next time this happens.

Crash dumps from Task Manager

How to generate dumps: http://www.wintellect.com/devcenter/jrobbins/how-to-capture-a-minidump-let-me-count-the-ways

Also, the taskmgr dump is 64-bit which makes it hard to look at managed code in. In future, if you could start C:\Windows\SysWow64\taskmgr.exe to capture dumps of devenv.exe it's a lot easier to investigate (SOS.dll doesn't work for 64-bit dumps of 32-bit processes)

Courtesy dotnet/roslyn#16900 (comment)

Use procdump

procdump -ma -e 1 -f C00000FD.STACK_OVERFLOW -g -w <your process name>.exe

See dotnet/fsharp#2682 (comment)

Debug native F# types

Turn on legacy visualizer in VS debugging options. Or add DebuggerDisplay on newly defined F# types to ease debugging.

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