}
}
- // If it was, or if it's storing an action, try to follow through to the action's target.
+ // If we now have an Action, try to follow through to the delegate's target.
if ((offset = GetObjFieldOffset(contObj.GetAddress(), contObj.GetMT(), W("_target"))) != 0)
{
MOVE(*contAddr, contObj.GetAddress() + offset);
if (sos::IsObject(*contAddr, false))
{
contObj = TO_TADDR(*contAddr);
+
+ // In some cases, the delegate's target might be a ContinuationWrapper, in which case we want to unwrap that as well.
+ if (_wcsncmp(contObj.GetTypeName(), W("System.Runtime.CompilerServices.AsyncMethodBuilderCore+ContinuationWrapper"), 74) == 0 &&
+ (offset = GetObjFieldOffset(contObj.GetAddress(), contObj.GetMT(), W("_continuation"))) != 0)
+ {
+ MOVE(*contAddr, contObj.GetAddress() + offset);
+ if (sos::IsObject(*contAddr, false))
+ {
+ contObj = TO_TADDR(*contAddr);
+ if ((offset = GetObjFieldOffset(contObj.GetAddress(), contObj.GetMT(), W("_target"))) != 0)
+ {
+ MOVE(*contAddr, contObj.GetAddress() + offset);
+ if (sos::IsObject(*contAddr, false))
+ {
+ contObj = TO_TADDR(*contAddr);
+ }
+ }
+ }
+ }
}
}
}
/// (like the action after that (which is also a ContinuationWrapper and thus form a linked list).
/// We also store that task if the action is associate with at task.
/// </summary>
- private sealed class ContinuationWrapper
+ private sealed class ContinuationWrapper // SOS DumpAsync command depends on this name
{
private readonly Action<Action, Task> _invokeAction; // This wrapper is an action that wraps another action, this is that Action.
- internal readonly Action _continuation; // This is continuation which will happen after m_invokeAction (and is probably a ContinuationWrapper)
+ internal readonly Action _continuation; // This is continuation which will happen after m_invokeAction (and is probably a ContinuationWrapper). SOS DumpAsync command depends on this name.
internal readonly Task _innerTask; // If the continuation is logically going to invoke a task, this is that task (may be null)
internal ContinuationWrapper(Action continuation, Action<Action, Task> invokeAction, Task innerTask)