HttpClient - Xamarin Android - MvvmCross

I am developing an Android application using Xamarin with MvvmCross, and everything is going well, I and my team managed to develop a solution, and this week we decided to make final adjustments and test the application in a different environment. During the tests, I had a huge problem with the solution for Android. In the working environment, everything worked fine, but when I tried to test the application at home, the application stopped working. I checked what was happening and I found out that HttpClient was unable to complete the server call and selected the following exception:

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter`1[System.Net.Http.HttpResponseMessage].GetResult () [0x00000] in <filename unknown>:0 at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x00000] in <filename unknown>:0 

I searched the solution on Google and I found a similar problem on the Xamarin forum http://forums.xamarin.com/discussion/30152/error-nameresolutionfailure (post by Jefimijana) and one of the answers was about the wrong network configuration, which seems strange to me because all other applications are working fine. I tested a WPF application connected to the same Wi-Fi to check if there are any problems, but it worked fine. Thus, I faced an even more serious problem, I can not tell the user that he must reconfigure his Wi-Fi connection when all other applications are working correctly, and I can not make my application not work with any Wi-Fi for no apparent reason. So my question is, is there a solution to this problem? Is this some kind of Xamarin issue related to HttpClient? Or is this a problem with Android?

  • The device I tested the application with is the Galaxy Tab 3 tab

Thanks,

+3
android xamarin xamarin.android mvvmcross
source share
1 answer

Unfortunately, you have not provided any more information about what you are trying to do, but I can confirm that we are seeing similar behavior with an error in our Xamarin.Android applications.

Mono Network Stack on Android has at least two problems (as of February 2015) that we are experiencing, so you are not alone:

The best workaround that I can recommend to you at the moment is to use ModernHttpClient , which is an implementation of HttpClientHandler , which uses its own API and therefore doesn’t work t enable a mono network stack (plus it is much faster).

+7
source

All Articles