Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 45927 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
I have this code:
var request = (HttpWebRequest)WebRequest.Create(@"http://www.xamarin.com");
IAsyncResult result = request.BeginGetResponse(null, null);
using (var response = (HttpWebResponse)request.EndGetResponse(result))
catch (Exception ex)
Steps to reproduce
1. Launch app.
2. Disable internet connection
3. Run this code (for example attach it to button)
4. As expected exception is thrown
5. Reconnect to internet
6. Run this code. InvalidOperationException is thrown every time
This code works good if app is always online. It is reproducing on Xamarin.iOs and Xamarin.Mac.
Hey, I just tried with a quick Mac template, added a button and hooked up the code you mentioned above and it works just fine.
Using some Console.WriteLine I'm getting a response with an "ok" status when clicking with an internet connection then a `Exception: System.Net.WebException: Error: ConnectFailure (Network is unreachable) ---> System.Net.Sockets.SocketException: Network is unreachable` when the network is off, then the response with the ok status again when it's turned back on.
Could you please attach 2 things to this bug in order for us to understand what your issue it:
- A test case / project sample (Mac or iOS) that doesn't work for you locally and has the above code.
- Your about information:
The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).
Vincent Dondain, thank you for testing so fast!
It is working good the way you described. It is Not working ONLY if first request after
application launch was offline. I know it sounds strange, but it is reproducing on our Xamarin.iOs, Android and Mac apps.
=== Xamarin Studio Community ===
Version 6.1.1 (build 15)
Installation UUID: 7561d134-f95f-4234-9142-ab7d13a20ffe
Mono 4.6.1 (mono-4.6.0-branch-c8sr0/ef43c15) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 406010005
=== Xamarin.iOS ===
Version: 10.0.1.10 (Xamarin Studio Community)
Build date: 2016-10-03 15:18:44-0400
=== Xamarin.Mac ===
Version: 126.96.36.199 (Xamarin Studio Community)
=== Build Information ===
Release ID: 601010015
Git revision: fa52f02641726146e2589ed86ec4097fbe101888
Build date: 2016-09-22 08:03:02-04
Xamarin addins: 75d65712af93d54dc39ae4c42b21dfa574859fd6
Build lane: monodevelop-lion-cycle8-sr0
=== Operating System ===
Mac OS X 10.12.0
Darwin Ostaps-MacBook-Pro.local 16.0.0 Darwin Kernel Version 16.0.0
Mon Aug 29 17:56:20 PDT 2016
Ah indeed I see what you mean, that for the precisions, I did not follow your repro steps careful enough (;
If you launch the app, disable the network right away and click on the button to action the above code, even if you restore the network you'll always get this "Exception: System.Net.WebException: Error: NameResolutionFailure"
Here's a test case for other team members: https://www.dropbox.com/s/onlcxu43usr248y/Bug45927.zip?dl=0