Created attachment 11068 [details]
NetworkReachability.TryGetFlags hangs when the network packet loss is 100%.
**Steps to Reproduce:**
1. Use the Network Link Conditioner to cause 100% packet loss (if you need that, http://nshipster.com/network-link-conditioner/)
2. Run the attached sample on an iOS Simulator
It will hang when launching because of the IsHostReachable call of the Reachability.cs class
No hang, and it should return false.
**Build Date & Platform:**
The code being used for the Reachability sample is
public static bool IsHostReachable(string host)
using (var r = new NetworkReachability(host))
if (r.TryGetFlags(out flags)) // Hangs here
The call to `SCNetworkReachabilityGetFlags` takes a few seconds but it does get back and shows
2015-05-07 16:52:00.281 ReachabilityTest[90947:19574570] false
hmm... maybe it took more time than the simulator watchdog allowed ?
@John could you reproduce it ? is so where the call stack if you hit pause ? or does it eventually quit (watchdog) ?
Having undefined time functions calls in FinishedLaunching is a common issue  that can bite you back - generally seen on device (but there's now a watchdog on the simulator too).
I'm experiencing a similar issue. My app starts several image downloads. Before they are all finished, I use Network Link Conditioner to manipulate my connection so that all packets are lost. The requests that are still in progress never return.
I moved the code to the ViewDidLoad and it does not hang. Instead, IsHostReachable returns true, even with 100% packet loss - which seems wrong as the host is not reachable.
I also have IsHostReachable returns true when I set the "Settings -> Developer -> Status -> 100% loss".
Has anyone managed to confirm whether this is a defect yet?
I am experiencing exactly the same issue, inside Xamarin CrossConnectivity plugin. On iPhone 4 device it takes about 30 seconds, iOS 8 simulator about 20-30s, iOS 9 simulator about 5s. If called in FinishedLaunching, app crashes because of watchdog.
we will check if it is a bug on our side or apple is not giving us the right values
I can confirm using the latest Xamarin.iOS 10.12.0.14, the app no longer hangs but `IsHostReachable` returns `true`, even with 100% packet loss
Marking this report as CONFIRMED.
SCNetworkReachabilityGetFlags (called from TryGetFlags) is a synchronous API  and should not be called in `FinishedLaunching` since the watchdog might kill the process if it takes too long.
Even with 100% packet loss iOS' SCNetworkReachabilityGetFlags returns 0 (Ok) and flags == Reachable. This _might_ be because the reachability status is cached (before being set to 100% packet loss). The internal of this code is not documented with enough details.
However the meaning of reachable  does not mean a connection was done, only that the OS believe it can be done, i.e. reachable means the network configuration can be used to reach it . IOW using reachability with packet loss does not work  like you expect.
note: The method `IsHostReachable` (mentioned in comment #9) is part of the user code (not XI).