观看,暂停和在运行的.NET应用程序查杀线程线程、查杀、应用程序、NET

2023-09-04 12:52:41 作者:轻佻一眼

我工作的一个.Net应用程序多线程做各种各样的事情。 当不顺心的事在生产中我希望能够看到哪个线程运行(由他们管理的名称),也可以暂停/杀死他们。

I'm working on a .Net applications with multiple threads doing all sorts of things. When something goes wrong in production I want to be able to see which threads are running (by their managed name) and also be able to pause / kill them.

反正实现这一目标?

VS并不总是可用的(虽然是很好的选择,如果是),而WinDbg的UI不是为精简版心肠。

VS isn't always available (although a good option when is), and WinDbg UI isn't for the lite hearted.

我认为是在程序的线程窗口,像VS具有调试时,却找不到一个编程的方式来做到这一点。 Process.GetThreads返回很少的可用数据。

I considered a in-program threads window, like VS has while debugging, but couldn't find a programmatic way to do this. Process.GetThreads returns very little usable data.

推荐答案

没有什么内置在.NET中,将做到这一点。如果你想通过你的活动线程编程迭代,你必须在某处进行注册的推出,要么注销他们完成或过滤他们你对他们采取行动之前。我们做了一个版本,这一点,它需要工作不平凡的金额。

There's nothing built in to .net that will do this. If you want to programmatically iterate through your active threads, you have to register them somewhere on launch and either unregister them on completion or filter them before you act on them. We did a version of this and it requires a non-trivial amount of work.