.net 如何在 Visual Studio 中找到堆栈跟踪?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/945193/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 12:48:04  来源:igfitidea点击:

How do I find the stack trace in Visual Studio?

.netvisual-studiodebuggingexception-handlingstack-trace

提问by Even Mien

I ask because I couldn't find the stack trace in Visual Studio, while debugging an exception that occurred.

我问是因为我在 Visual Studio 中找不到堆栈跟踪,同时调试发生的异常。

回答by cdonner

While debugging, Go to Debug -> Windows -> Call Stack

调试时,转到调试 -> Windows -> 调用堆栈

回答by CharithJ

While debugging, when you hit a break-point.

在调试时当您遇到断点时

CTRL+ALT+C

CTRL+ ALT+C

enter image description here

在此处输入图片说明

回答by Brian Rasmussen

The default shortcut key is Ctrl-Alt-C.

默认快捷键是 Ctrl-Alt-C。

回答by Ofek Shilon

Do you mean finding a stack trace of the thrown exception location? That's either Debug/Exceptions, or better - Ctrl-Alt-E. Set filters for the exceptions you want to break on.

你的意思是找到抛出异常位置的堆栈跟踪?那要么是调试/异常,要么更好 - Ctrl-Alt-E。为要中断的异常设置过滤器。

There's even a way to reconstruct the thrower stack afterthe exception was caught, but it's really unpleasant. Much, much easier to set a break on the throw.

甚至还有一种方法可以在异常被捕获重建 thrower 堆栈,但确实很不愉快。在投掷时设置休息要容易得多。

回答by Kumar Manish

Using the Call Stack Window

使用调用堆栈窗口

To open the Call Stack window in Visual Studio, from the Debug menu, choose Windows>Call Stack. To set the local context to a particular row in the stack trace display, double click the first column of the row.

要在 Visual Studio 中打开“调用堆栈”窗口,请从“调试”菜单中选择“Windows”>“调用堆栈”。要将本地上下文设置为堆栈跟踪显示中的特定行,请双击该行的第一列。

http://msdn.microsoft.com/en-us/library/windows/hardware/hh439516(v=vs.85).aspx

http://msdn.microsoft.com/en-us/library/windows/hardware/hh439516(v=vs.85).aspx

回答by Vin

Consider this as the current update (Windows 10 (Version 1803) and Visual Studio 2017): I was unable to view the stack trace window and did find an option/menu item to view it. On investigating further, it seems this feature is not available on Windows 10. For further information please refer:

将此视为当前更新(Windows 10(版本 1803)和 Visual Studio 2017):我无法查看堆栈跟踪窗口,但确实找到了一个选项/菜单项来查看它。经过进一步调查,似乎此功能在 Windows 10 上不可用。有关更多信息,请参阅:

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/viewing-the-call-stack-in-visual-studio

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/viewing-the-call-stack-in-visual-studio

Copied from the above link: "This feature is not available in Windows 10, version 1507 and later versions of the WDK."

复制自上述链接:“此功能在 Windows 10 版本 1507 及更高版本的 WDK 中不可用。”

回答by braX

For Visual Studio 2019, the shortcut (while debugging and stopped at a breakpoint)is:

对于 Visual Studio 2019,快捷方式(在调试时并在断点处停止)是:

Ctrl+Alt+Cand now you can also use Ctrl+L

Ctrl+ Alt+C现在你也可以使用Ctrl+L

The screenshot is pretty old. Here is one for Visual Studio 2019 (under the debug menu):

截图已经很老了。这是 Visual Studio 2019 的一个(在调试菜单下):

Visual Studio 2019 Call Stack Menu Option

Visual Studio 2019 调用堆栈菜单选项