Here's my test code. With this code, my form will get stuck after executing task.Result
(it's a "not yet computed" status).
I know this is bad programming style - but I'm curious what happened about this task.Result
status.
Thanks.
private async Task<int> func()
{
await Task.Run(() =>
{
;
});
return 1;
}
private async void button1_Click(object sender, EventArgs e)
{
Task<int> task = func();
if (task.Result > 1)
{ ; }
await task;
}