.net 挂在 Application.DoEvents 上
我们的遗留产品之一是 Winforms 应用程序,它不使用后台线程,而是在主 UI 线程上执行所有操作。它有一个在此主线程上运行的恒定循环,每 20 毫秒调用一次 Application.DoEvents()。有时,应用程序会在 DoEvents 调用处挂起。我的问题是如何找出代码在哪个排队事件调用中挂起?
PS 有人知道我可以使用一个工具来获取进程中每个线程的堆栈跟踪吗?
此外,这种情况只发生在生产客户端,我们现在必须解决这个问题。也不可能在客户端安装 VS。
One of our legacy products is a Winforms application and instead of using background threads it does everything on the main UI thread. It has a constant loop running on this main thread that calls Application.DoEvents() every 20 ms. Once in a while the application just hangs at the DoEvents call. My question is how do I find out in what queued event call the code is hanging?
P.S. Does someone know of a tool that I can use to get the stack trace of every thread in a process?
Also, this is only happening at a production client and we got to get a fix out now. No possibility in installing VS at the client either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 Visual Studio 中执行此操作,只需附加到进程、中断执行并打开线程窗口即可。
菜单:调试->Windows->线程
You can do that in visual studio, just attach to the process, break execution and open the threads windows.
Menu: Debug->Windows->Threads
我找到了我正在寻找的工具。 WinDbg
它可以获取当前正在运行的 Windows 进程的堆栈跟踪。但是,它确实需要该应用程序的 PDB 文件。
I found the tool I was looking for. WinDbg
It can get the stack traces for a currently running windows process. However it does require the PDB files for that application.