简体   繁体   English

调试Windows窗体线程冻结

[英]Debugging Windows Form Thread Freezes

I have a C# winforms application, which communicates to various com data sources, and uses a threadpool for most of its backend processing. 我有一个C#winforms应用程序,它可以与各种com数据源通信,并使用线程池进行大多数后端处理。 I have noticed that 2-3 times a day the winforms thread hangs for 20-30 seconds (visible in the ui, and that the com data stops for 20-30 secs). 我注意到,每天有2-3次winforms线程挂起20-30秒(在ui中可见,并且com数据停止20-30秒)。 I have since written a simple task on the threadpool that tracks a heartbeat on the winforms thread to detect these instances, but am looking for a way to automatically trigger a full dump (not a mini dump), so that I can see what exactly the winforms thread is doing during these pauses. 此后,我在线程池上编写了一个简单的任务,该任务跟踪winforms线程上的心跳以检测这些实例,但是我正在寻找一种自动触发完整转储(而不是小型转储)的方法,以便我可以确切地看到在这些暂停期间,winforms线程正在执行。

Are there any simple command line apps that my background thread can call on it's own process to bind to the app as a debugger, generate the full dump file, and then allow the application to resume? 我的后台线程可以在自己的进程上调用任何简单的命令行应用程序,以将其作为调试器绑定到该应用程序,生成完整的转储文件,然后允许该应用程序恢复吗?

Is there a better way to debug this? 有更好的方法来调试吗?

听起来Process Dumper应该可以解决问题。

You can use the SysInternals procdump utility to generate dump files: 您可以使用SysInternals procdump实用程序生成转储文件:

ProcDump is a command-line utility whose primary purpose is monitoring an application for CPU spikes and generating crash dumps during a spike that an administrator or developer can use to determine the cause of the spike. ProcDump是一个命令行实用程序,其主要目的是监视应用程序中的CPU尖峰并在尖峰期间生成崩溃转储,管理员或开发人员可以使用它来确定尖峰原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM