HttpClient freezing on Android

Guy 96 Reputation points

I have a very simple MVVM application using Xamrin Forms and Prism, built from the Prism Xamarin Template.

When I initialize a new ViewModel I am trying to make a call to an API, on UWP this is working without any issues but on Android it is just freezing and not returning any errors or throwing any exceptions.

I have simplified the code down to where the error is happening and tested with a URI that anyone can use.

public async Task InitializeAsync(INavigationParameters parameters)  
            var client = new HttpClient();  
            var response = await client.GetAsync("").ConfigureAwait(false);  
        catch (Exception ex)  

I am using the below NuGets

  • Prism.Core v8.0.0.1909
  • Prism.Dryloc.Forms v8.0.0.1909
  • Xamarin.Forms v4.8.0.1687

I have set the HttpClient implementation to Android and Native TLS 1.2+ enter image description here

I have set internet permissions in the Android Manifest

I have reviewed several other posts that seem similar but have had no joy in fixing the issue, can anyone shed any light on how I can troubleshoot this or get it working?

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,298 questions
0 comments No comments
{count} votes

Accepted answer
  1. Guy 96 Reputation points

    After troubleshooting this for a while and banging my head against a brick wall I've finally figured out what was going wrong.


    Step through on Android wasn't stepping past line 7 below and the screen wasn't redrawing.

    var response = await client.GetAsync("").ConfigureAwait(false);

    When I turned my phone 90 degrees the screen would redraw and I could see that the request had worked.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Alessandro Caliaro 4,181 Reputation points

    Have you set internet permission in the manifest?