Reputation: 806
Have one line of code:
var task = await TaskEx.Run(()=>{ Thread.Sleep(100000) });
That works as should be.
But if i write without await:
var task = TaskEx.Run(()=>{
Thread.Sleep(100000); //breakpoint
});
Why am i reaching breakpoint? Isnt that just a reference to task? I am using .net 3.5 asyncbridge.
Upvotes: 2
Views: 481
Reputation: 171246
I'm guessing the misunderstanding that you might have: TaskEx.Run
not only creates a task - it starts it as well. await
does not start a task - it just pauses the method until the awaited task completes.
Upvotes: 3