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!!
So I went back to basics.
- New simple app: https://github.com/GarthConnell/XamarinCouchbaseTest
- Wifi and mobile data disabled
- 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.
My Stack is: Android 6, VS2019, Xamarin 5
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 126.96.36.1998. 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.
I have created a ticket for issue investigation and fix. Just curious what device you were using when you saw this issue happening?
Both were C72 chainway device, Android 6 and 8. I am going to try something creative and see if I can get a test running on the emulators.
Ok, some more testing. I realised the problem exists even if I just misname the host, so using
Couchbase Lite 188.8.131.52 Nuget
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!!
We probably have fixed this issue in our upcoming release 3.0.2. The release should be out before the end of Aug.