I have found no way of dumping the stack on all threads in .NET. Neither a signal to be send to the process nor programatic access to all the threads. I can only get access to t
If you need to do this programmatically (maybe you want automatic dumps during your CI process), you can use the info from this answer to a different question.
Basically, attach to your own process using CLR MD:
using Microsoft.Diagnostics.Runtime;
using (DataTarget target = DataTarget.AttachToProcess(
Process.GetCurrentProcess().Id, 5000, AttachFlag.Passive))
{
ClrRuntime runtime = target.ClrVersions.First().CreateRuntime();
foreach (ClrThread thread in runtime.Threads)
{
IList stackFrames = thread.StackTrace;
PrintStackTrace(stackFrames);
}
}
Here PrintStackTrace is left as an exercise for the reader.