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)
{
try
{
var client = new HttpClient();
var response = await client.GetAsync("https://www.google.co.uk").ConfigureAwait(false);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
}
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?