Forum Xamarin.Forms

Xamarin Forms Android app just quits with no exception

Hey guys, this is my first post so take it easy ;)

So, I got the job of porting a legacy VB.net Windows Mobile 6.5 app to Android and the obvious choice was Xamarin even though I had no experience with it whatsoever.

I've got an issue at the moment where the android app just quits without exception. I've managed to trace it back to this line.

PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));

I've checked all the properties and they all seem fine, no nulls etc.

I've also found this in the Debug output:

Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 9154

I've googled this and spent the last 2 days trying various things like changing compiler options but to no avail. Is there a way to get more detailed information ? I am not familiar with the workings of Android so if its anything specific please explain in detail.

I'm using:

VS2019 community (not preview)
XF: 4.7.0.1351 (tried the latest 4.8.0.1451 but the same happens)
Android: 9.0 API 28

Running on an emulator also tried actual device.

Best Answer

  • henda79henda79 Member ✭✭
    Accepted Answer

    So this turned turned out to be because the object which was used in the bindings was been cloned from another source afterwards.

Answers

  • matrixlukanmatrixlukan Member ✭✭✭
    edited September 21

    First of all, always keep an eye on the visual studio console/debug window while debugging. All exceptions are logged in those consoles and use this information to find out the fix.
    Anyway, during my development, I have faced similar issues. I can give you a tip: 'All UI related things should happen in UI Thread'.

  • jezhjezh Member, Xamarin Team Xamurai

    I've got an issue at the moment where the android app just quits without exception. I've managed to trace it back to this line.

    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));

    Yes, we should keep an eye on our app's logs in console,debug and Error List window,just as follows:

    And we can follow these logs showing in above windows for clues to the problem in our app.

    We can open the Output window by clicking menu View -> Output option.

    For more details, you can check: https://docs.microsoft.com/en-us/visualstudio/ide/reference/output-window?view=vs-2019

  • henda79henda79 Member ✭✭

    Thanks for the tips but the Output window did not contain anything meaningful. I'm also aware of the threading issues and I've checked in this case by using Device.IsInvokeRequired, however this returns false so I assume its already on the main thread.

    Here is a dump of the android logcat

    09-20 14:09:03.764 777 777 F : Why are we setting the target on an unoccupied slot?
    --------- beginning of crash
    09-20 14:09:03.764 777 777 F libc : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 777, pid 777
    09-20 14:09:03.790 852 852 I crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
    09-20 14:09:03.790 1747 1747 I /system/bin/tombstoned: received crash request for pid 777
    09-20 14:09:03.791 852 852 I crash_dump32: performing dump of process 777 (target tid = 777)
    09-20 14:09:03.795 852 852 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    09-20 14:09:03.795 852 852 F DEBUG : Build fingerprint: 'google/sdk_gphone_x86_arm/generic_x86_arm:9/PSR1.180720.117/5875966:user/release-keys'
    09-20 14:09:03.795 852 852 F DEBUG : Revision: '0'
    09-20 14:09:03.795 852 852 F DEBUG : ABI: 'x86'
    09-20 14:09:03.795 852 852 F DEBUG : pid: 777, tid: 777
    09-20 14:09:03.795 852 852 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
    09-20 14:09:03.795 852 852 F DEBUG : Abort message: 'Why are we setting the target on an unoccupied slot?'
    09-20 14:09:03.795 852 852 F DEBUG : eax 00000000 ebx 00000309 ecx 00000309 edx 00000006
    09-20 14:09:03.796 852 852 F DEBUG : edi 00000309 esi c5462780
    09-20 14:09:03.796 852 852 F DEBUG : ebp ffa9f6b8 esp ffa9f608 eip f66dfb39
    09-20 14:09:03.796 852 852 F DEBUG :
    09-20 14:09:03.796 852 852 F DEBUG : backtrace:
    09-20 14:09:03.796 852 852 F DEBUG : #00 pc 00000b39 [vdso:f66df000] (__kernel_vsyscall+9)
    09-20 14:09:03.796 852 852 F DEBUG : #01 pc 0001fdf8 /system/lib/libc.so (syscall+40)
    09-20 14:09:03.796 852 852 F DEBUG : #02 pc 00022ed3 /system/lib/libc.so (abort+115)

    There is a message in there which appeared in the Output window:

    "Why are we setting the target on an unoccupied slot?"

    However when googling this there are only 2 results, one which seem to be the source code and the other is my stackoverflow question.

  • henda79henda79 Member ✭✭

    I've since downgraded to XF 4.7.0.968 and the problem seems to have gone. So this could well be a bug with the newer XF assemblies. I have tried the latest 4.8 version and that to has the issue.

  • jezhjezh Member, Xamarin Team Xamurai
    edited September 22

    You can post this issue here: https://github.com/xamarin/Xamarin.Forms/issues

    And the xamarin development team will follow up this issue.
    We apologize for any inconvenience this may cause.

    Thank you for supporting Xamarin. :)

  • henda79henda79 Member ✭✭

    ok, so after a bit more digging the issue doesn't seem related to a XF bug.

    So as I've said it crashes without exception when Invoking the PropertyChanged method.

    Using the debugger I've inspected the properties and found that PropertyChanged is a MulticastDelegate with one subscriber... and that subscriber lives in an external assembly which is still my code just another project as it's the Data Access Layer.

    Is it allowed to Invoke like this across assemblies ? I've put a BP on the method which is supposed to be invoked but the app is killed before it gets hit.

  • jezhjezh Member, Xamarin Team Xamurai

    Is it allowed to Invoke like this across assemblies ? I've put a BP on the method which is supposed to be invoked but the app is killed before it gets hit.

    Sorry, I am confused with what you said. What's the mean of these words Invoke like this across assemblies and the BP ? Could you elaborate on your question?

  • henda79henda79 Member ✭✭
    Accepted Answer

    So this turned turned out to be because the object which was used in the bindings was been cloned from another source afterwards.

Sign In or Register to comment.