Been investigating this for a whole day, and I don't know where to turn.
I originally created a normal Xamarin.Forms project in Visual Studio using a profile-based PCL. In the PCL, I catch System.Net.WebException
, which is raised e.g. if a request is performed and there is no internet connection.
I then converted my projects to .NET Standard (netstandard1.2), which meant that in the PCL, I had to change System.Net.WebException
System.Net.Http.HttpRequestException
. This works fine on all platforms except Android. On Android, the former exception is still thrown. Naturally, I am unable to capture this in the PCL since there is no System.Net.WebException
anymore in .NET standard (according to Intellisense, at least).
I even re-created the solution from scratch using this Xamarin.Forms .NET standard template, to no avail. I get the exact same problem.
On the whole, I'm considering giving up on the whole .NET Standard thing until the Xamarin/VS/netstandard combo becomes more mature.
Does anyone have the slightest idea why System.Net.WebException
is raised instead of System.Net.Http.HttpRequestException
on Android when using .NET Standard, and whether it's possible to raise System.Net.Http.HttpRequestException
instead?
Please let me know if I can provide more information that could be of help.