Realtime Database Flightmode Crash UnknownHostException

Backendless Version (3.x / 5.x, Online / Managed / Pro )

latest cloud backend

Client SDK (REST / Android / Objective-C / Swift / JS )

Xamarin.Forms App with Backendless.NET Nuget V6.2.0 (iOS+Android same behavior)

Application ID

852EE6BB-B3FF-A610-FF25-F064DAE8E300

Expected Behavior

  1. Implemented the Realtime Database Feature in iOS and Android .NET Xamarin App
  2. Start the app and toggle flightmode ON (no internet connection)
  3. RT Database connection should be interrupted and wait until a connection is available

Actual Behavior

  1. As soon as the user toggles the flightmode the app crashes immediately
  2. this happens on both platforms (iOS and Android)
  3. if you do not enable RT-Database, the app stays alive
    The exception differs on the platforms.
  • On Android the app crashes with a Java.Net.UnknownHostException (unable to resolve host “api.backendless.com”: No address associated with hostname)
  • On iOS the app crashes after few seconds with this error: System.Net.Http.HttpRequestException: The Internet connection appears to be offline. —> Foundation.NSErrorException

How can I catch these exceptions safely?

Reproducible Test Case

Checkout this Git-Repo to reproduce the issue
https://bitbucket.org/JanisTheuer/rtdata/src/master/

Already actions taken

I´ve tried to generally catch the exception without success.
On Xamarin there is a way to catch global exceptions on App.cs, but this didn’t trigger for this exception.

//Global Error Handling
AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
{
Exception ex = (Exception)args.ExceptionObject;
Debug.WriteLine($“GLOBAL UNHANDLED EXCEPTION (app.cs): {ex.Message}”);
};
TaskScheduler.UnobservedTaskException += (sender, args) =>
{
Exception ex = (Exception)args.Exception;
Debug.WriteLine($“GLOBAL UNHANDLED UnobservedTaskException (app.cs): {ex.Message}”);
};

Do you have other suggestions/ best-practice to avoid this bad behavior?

Hello @Janis

I’ve created an internal ticket BKNDLSS-24644 to investigate your problem.

Regard, Viktor