问题描述
我正在调试一个明显的并发问题在一个大的应用程序,我在工作中闯入。这个问题只能在运行许多(12 +)个小时之后的某些低性能机器上体现出来,而我从来没有在调试器中重现。因此,我的调试工具基本上仅限于分析日志文件。C#可以轻松获取抛出异常的线程的堆栈跟踪,但是我会喜欢在抛出异常的时候另外获取当前在我的AppDomain中执行的每个其他线程的堆栈跟踪。
这是可能吗?
CodePlex上有一个名为(我相信来自微软)。它使用调试和分析API捕获正在运行的.Net应用程序中的线程的堆栈跟踪,而无需修改应用程序。
您可以运行应用程序直到您遇到问题,然后使用此工具分析它,以捕获所有正在运行的线程的当前堆栈跟踪。这种方法的好处是您不需要修改应用程序(测试它可能会改变其行为),并且该工具是免费的。
I'm debugging an apparent concurrency issue in a largish app that I hack on at work. The bug in question only manifests on certain lower-performance machines after running for many (12+) hours, and I have never reproduced it in the debugger. Because of this, my debugging tools are basically limited to analyzing log files.
C# makes it easy to get the stack trace of the thread throwing the exception, but I'd like to additionally get the stack traces of every other thread currently executing in my AppDomain at the time the exception was thrown.
Is this possible?
There is a tool on CodePlex called Managed Stack Explorer (that I believe originated from Microsoft). It uses the debugging and profiling API to capture the stack traces of the threads in a running .Net application, without the need to modify the application.
You could run your application until you experience the issue, then analyse it using this tool to capture the current stack traces of all running threads. The benefit of this approach is that you leave your application unmodified (instrumenting it may change its behaviour), and the tool is free.
这篇关于我可以在我的c#应用程序中获取所有线程的堆栈跟踪吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!