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:
Start a second instance (a new window) of Visual Studio.
Close any open solutions in the new instance of VS.
Select Debug > Attach to Process.
Select the original hung instance of
devenv.exefrom the list of Available Processes.
Select Debug > Break All.
Make sure you have the Debug Location toolbar enabled.
From the Thread drop-down menu in the Debug Location toolbar, select Main Thread.
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.
Once you see the full call stack, select all the lines and copy and paste them into a text file.