I've got a monitor thread on a server that watchs for and kills hung threads or threads hogging a resource. Before killing the thread I would like to capture just the misbehaved thread's call stack to a log but do not see a way to do that with CreateBugReport or StackTrace. Would also like to use CreateBugReport without having to raise a bogus exception for it. Anyway to do this without deviating from your released code? I try to not touch vendor source as much as much as possible to make upgrades and support easier.
Thanks,
--Greg
Getting the trace of a specific thread
You can use CreateBugReport without raising a bogus exception. Just tell it that your program was frozen (= first parameter -> true). Then it will create a full bug report for you with the callstack of all running threads. Of course this may take longer than just calculating a callstack for that one specific thread, though.