Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
UI Example for deadlock async code.
// My "library" method.
public static async Task<JObject> GetJsonAsync(Uri uri)
using (var client = new HttpClient())
var jsonString = await client.GetStringAsync(uri);
return JObject.Parse(jsonString);
// My "top-level" method.
public void Button1_Click(...)
var jsonTask = GetJsonAsync(...);
textBox1.Text = jsonTask.Result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment