public async Task Unwrapping()
{
#region Output
"Starting proxy task".Output();
#endregion
Task<Task> proxyTask = Task.Factory.StartNew(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(10));
#region Output
"Done inside proxy".Output();
#endregion
});
await proxyTask;
#region Output
"Proxy task done.".Output();
"Starting actual task".Output();
#endregion
Task actualTask = Task.Factory.StartNew(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(10));
#region Output
"Done inside actual".Output();
#endregion
}).Unwrap();
await actualTask;
#region Output
"Actual task done.".Output();
#endregion
}