问题
I am working on a Visual Studio add-in (part of the ILSpy open source project) and I want to get information about the currently selected stack frame in the Visual Studio Call Stack window.
I tried this:
var callstackWindow = ((EnvDTE80.DTE2)GetGlobalService(typeof(EnvDTE.DTE))).ToolWindows.GetToolWindow("Call Stack");
However it throws an exception when not debugging (and Call Stack window not present) and returns null when the Call Stack window is present.
There is a vsWindowTypeCallStack member in the vsWindowType enumeration, but I can't find any API that uses it. I've searched the EnvDTE documentation without finding any further information.
I'm working in C# with Visual Studio 2013 Professional.
来源:https://stackoverflow.com/questions/36726595/how-to-get-a-programmable-interface-to-the-visual-studio-call-stack-window