Well this one caught me by surprise. I have been using CBL for years and did the unthinkable, went out of range of the Wi-Fi without a sim in the device, so truly offline. Suddenly my app wouldn’t start, and crashed everywhere!!
Use physical test device, the emulator just cannot emulate “no data” and still be debuggable!
It starts, starts connecting, and boom. Dies.
Log is here: Log
Reconnect WiFi, and its all good again.
Then to test, i changed the target endpoint to something non-existent, and it also crashed, even if the Wifi was on…
So I worked my way back, and found 2.84 works, and 2.86 and 3.00 crash like this.
The reason I switched is because IDatabase.CreateQuery is a Godsend.
I have tried the “if (Connectivity.NetworkAccess == NetworkAccess.Internet)
type stuff, but there are situations where Android thinks it has connectivity, but there is no route, or the router is faulty etc. etc, and the app crashes out.
Anyone have any ideas? I cant be the first to experience this.
Can you confirm that you mean Xamarin 5? That’s such an old version that I can’t even find a release date for it anymore and it’s certainly not a version that is in support anymore. Xamarin as a whole has made many improvements since then. My first recommendation would be trying it with a more modern version if that’s the case. I’ll ping @Sandy_Chuang about this because I know that we test situations like this and likely would have seen this if it happened universally.
Sorry, its Xamarin Forms 18.104.22.1688. So far I have only managed to test it on an Android 6.0 and 8.0 device with the same results. As I mentioned I cannot get the emulators to debug while disconnected, so my test bench is a bit limited.
Ok, some more testing. I realised the problem exists even if I just misname the host, so using
Couchbase Lite 22.214.171.124 Nuget
and var targetEndpoint = new URLEndpoint(new Uri("ws://zzz:4984/" + global.bucketstring));
With the Emulator:
Pixel 2 Pie 9.0 - API 28: Crashes
Pixel 2 Q 10.0 - API 29: Crashes
Pixel 2 R 11.0 - API 30: Works!!