In C# multi-threaded programming, when method A()
calls method B()
in a new thread, e.g. by using something like this:
Task A()
{
// ...
// I want B to run in parallel, without A() waiting for it.
Task.Factory.StartNew(B);
}
void B()
{
// I attach a debugger here to look at the Call Stack.
// But that is empty and I can't see that A() actually called it (logically).
// Also Environment.StackTrace is pretty much empty of that path.
}
In other words inside method B()
the stack trace doesn't know anything about the call path to method A()
which in turn triggered execute of method B()
.
Is there any way to see the full logical stack trace, so e.g. in the case of an exception in B()
you can see the full story to know A()
in effect called it?