Consider this,
Task task = new Task (async () =>{
await TaskEx.Delay(1000);
});
task.Start();
task.Wait();
The call task.Wait() does not wait for the task completion and the next line is executed immediately, but if I wrap the async lambda expression into a method call, the code works as expected.
private static async Task AwaitableMethod()
{
await TaskEx.Delay(1000);
}
then (updated according comment from svick)
await AwaitableMethod();