Xamarin Forms app crashes when replication started on Android

I want to provide a ready-to-use solution. I haven’t used Docker, not sure what else needs to be configured: user access? sample database?.. I was going to make a VirtualBox VM ready configured.

The last time that this issue occurred was before Xamarin was open source. I would consider maybe debugging it if I can get the same thing to happen but it’s not as simple as “a call gets made from this Couchbase code that triggers an assertion.” It’s more like there is an issue opening a file descriptor for some I/O bound work coming back from a thread.

Furthermore, I still know of no sane way to debug native code on an Android device when running a Xamarin app. Even assuming all that got working it’s not likely that I’ll find anything that will shed any light on the situations since it’s pretty deep rooted in the bowels of the .NET runtime.

Having a quickly reproducible solution would make a huge difference so thanks for that!

Still working on reporting the issue, but I got a full ready-to-use setup now to reproduce the crash.

Download solution:

  1. Open the solution in Visual Studio 2019 (Windows/for Mac), let the NuGet packages restore
  2. Run the solution on an attached Android 64-bit capable device (I use a Samsung A8 (2018)).
  3. On the login screen the values are pre-filled, just press SIGN IN.
  4. The app will crash.

Run - tap - crash. Couldn’t really get simpler than that.


Setup with the server, which is not actually needed to reproduce the crash

VirtualBox 6.0.8 VM with Ubuntu 18.04 LTS, Couchbase Server Community 6, Couchbase Gateway Community 2.5 , TravelSample database. Drive storage in vmdk format.
Visual Studio solution with mobile-travel-sample Android and Core projects.

Download A (VM, 1.26GB):


Download B (solution, 3.4MB):

  1. Run the VM and see which IP it uses.
  2. Open the solution in Visual Studio 2019 (Windows/for Mac), and edit:
  • TravelSample.Core / Util / Constants.cs:35 – replace 129.168.0.53 with the IP from the VM
  • TravelSample.Core / Models / LoginModel.cs:41 – replace 129.168.0.53 with the IP from the VM
  1. Run the solution on an attached Android 64-bit capable device (I use a Samsung A8 (2018)).
  2. On the login screen the values are pre-filled, just press SIGN IN.
  3. The app will crash.

Unfortunately I don’t have an arm64 device to try this on. I’ll see if it still crashes with the arm64 / armv7 combination build on my Nexus 5.

My first attempt with an older version of VS2019 / Xamarin didn’t result in a crash.

Updating to the latest stable at present:

VS Version 8.0.8 (build 2)
Version: 9.2.3.0 (Visual Studio Community)
Android SDK: /Users/borrrden/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		8.0 (API level 26)
		8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.1
SDK Build Tools Version: 28.0.3

Build Information: 
Mono: mono/mono/2018-08-rc@5ac37ccd385

Tried API 28 for the target as well, since that was mentioned above. No crash yet. Can you confirm that the first project needs no server in order to crash? I will download an arm64 emulator (though the newest system image provided by Google is 7.1) to see if that helps.

Well the emulator has been running for over an hour and it’s still on the Android boot screen for crying out loud so I guess that idea is out.

I get the crash on my Nexus 5 running Android 8.1. And that should not be 64 bit. If I just tick the arm64 ABI it will crash.

Ok then could you provide the versions of everything you use so that I can get the same “moving parts”:

Android Target SDK
VS Mac version
Xamarin Android Version
Android Build Tools Version
Android Platform Tools Version

Basically everything that deals with Android from the VS Mac “about” menu under show details. I tried several variations and pushing “sign in” does not cause any kind of crash on my device (however it’s a nexus 5 so it is maxed at API 23)

I do not have a Nexus 5. The only 64-bit device I have is the Samsung A8 (2018), and it runs Pie. I had to go buy this Samsung phone especially to test for this problem. Our users reported this problem using this device running Pie. All my other devices are 32-bit Android 8.1.

Another phone that our app crashed on due to this is a Nokia 7 Plus running Pie. But I can’t confirm this first hand.

Android Target API 27 (TravelSample), minimum API 19; my own app targets API 28, minimum API 26
VS Mac version 8.0.8 (build 2)
Xamarin Android Version 9.2.3.0
Android Build Tools Version 28.0.3
Android Platform Tools Version 28.0.3
Mono Framework MDK 5.18.1.3 (2018-08)
.NET Core 2.1.9, 2.2.4, 2.2.5 (SDK 2.1.505)
Android SDKs installed: 27 (v3), 28 (v6)

So it seems like a requirement is a device running Pie? Are there any reports of this on a non-Pie device?

I don’t know if Pie is a requirement or not. The 32-bit binary works on 64-bit Pie at least. I don’t have a 64-bit capable phone that is on Oreo.

We’re going to try and flash downgrade to Oreo to confirm if it’s Pie or not.

We are unable to flash downgrade the phone. So we can’t confirm at this time if Pie is a factor or not.

Alright since it seems that I don’t have the capacity to reproduce this, I think one of you should file this and I will provide any needed backup on the filed ticket.

Issue filed: https://github.com/mono/mono/issues/14848

1 Like

Great I added myself as a subscriber

Is there anything that can be done with the commit listed there?

I believe that if you build the Xamarin framework yourself that you can drop it in and then the runtime in your app, built with the framework that you built, will have the fix inside.