How do I collect the call stack of Visual Studio's Main Thread?

PDF for offline use

Let us know how you feel about this


last updated: 2016-12

When the GUI locks up (hangs, freezes) in Visual Studio, one important diagnostic step is to check the call stack of the Main Thread (the GUI thread). To collect this call stack from a hung instance of VS, you can use a second instance of Visual Studio:

  1. Start a second instance (a new window) of Visual Studio.

  2. Close any open solutions in the new instance of VS.

  3. Select Debug > Attach to Process.

  4. Select the original hung instance of devenv.exe from the list of Available Processes.

  5. Select Debug > Break All.

  6. Make sure you have the Debug Location toolbar enabled.

  7. From the Thread drop-down menu in the Debug Location toolbar, select Main Thread.

  8. Open Debug > Windows > Call Stack. If the Call Stack contains any lines that say [External Code], right-click [External Code] and select Show External Code from the context menu before copying the information.

  9. Once you see the full call stack, select all the lines and copy and paste them into a text file.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.