导致死锁的例子代码:
public static async Task GetWebPageAsync(string uri)
{
//这里的 client 是全局初始化的 HttpClient 对象
return = await client.GetStringAsync(uri);
}
public void Button1_Click(object sender, EventArg e)
{
var webTask = GetWebPageAsync("_get_url_");
textBox1.Text = webTask.Result;
}
{
//这里的 client 是全局初始化的 HttpClient 对象
return = await client.GetStringAsync(uri);
}
public void Button1_Click(object sender, EventArg e)
{
var webTask = GetWebPageAsync("_get_url_");
textBox1.Text = webTask.Result;
}
阅读全文……