Skip to content

Commit

Permalink
Added ConfigureAwait(false) after GetAsync method of HttpClient to le…
Browse files Browse the repository at this point in the history
…t the code after the callback (await) run in the same thread as created in the GetAsync method. By default this is not the case and when running this code on the UI thread it will cause the UI thread to hang (deadlock).
  • Loading branch information
boelew committed Jan 17, 2024
1 parent 5312892 commit 4110f36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion MdXaml/ImageLoaderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private static async Task<Result<Stream>> OpenStreamAsync(Uri resourceUrl)
{
case "http":
case "https":
var httpResult = await s_client.GetAsync(resourceUrl);
var httpResult = await s_client.GetAsync(resourceUrl).ConfigureAwait(false);
if (httpResult.StatusCode == HttpStatusCode.OK)
{
var webstream = await httpResult.Content.ReadAsStreamAsync();
Expand Down

0 comments on commit 4110f36

Please sign in to comment.