0

Newbie to Xamarin.Android and Xamarin in general.

So I have this huge legacy application that I am managing. I have integrated HockeyApp crash reporting too recently to log user crashes.

But from time to time, I am seeing this odd behaviours where the app does not show the force close dialog but closes suddenly. While many people on the internet are suggesting this might be due to an ANR, I have not any such indication in my logs. Luckily i got a crash log from one instance when this happened. Log is as below -

02-14 13:11:02.149  3353  3814 I InputDispatcher: Delivering touch to (30316): action: 0x1, toolType: 1

02-14 13:11:02.149 30316 30316 D ViewRootImpl: ViewPostImeInputStage processPointer 1

02-14 13:11:02.149  3353  6111 D SSRM:n  : SIOP:: AP = 310, PST = 290 (W:6), CP = 247, CUR = -200, LCD = 122

02-14 13:11:02.199 30316 30316 I MonoDroid: UNHANDLED EXCEPTION:

02-14 13:11:02.239 30316 30316 I MonoDroid: System.NullReferenceException: Object reference not set to an instance of an object

02-14 13:11:02.239 30316 30316 I MonoDroid:   at PinForce.Framework.Survey.Display.SurveySwitchboardFragment.RetryLocationUpdate (System.Object sender, Android.Content.DialogClickEventArgs e) [0x0000d] in <a731f67d79cd409f9381543d127a12b1>:0 

02-14 13:11:02.239 30316 30316 I MonoDroid:   at (wrapper delegate-invoke) System.EventHandler`1[Android.Content.DialogClickEventArgs]:invoke_void_object_TEventArgs (object,Android.Content.DialogClickEventArgs)

02-14 13:11:02.239 30316 30316 I MonoDroid:   at Android.Content.IDialogInterfaceOnClickListenerImplementor.OnClick (Android.Content.IDialogInterface dialog, System.Int32 which) [0x00015] in <9972d091c0994661959bc196bd63a3ee>:0 

02-14 13:11:02.239 30316 30316 I MonoDroid:   at Android.Content.IDialogInterfaceOnClickListenerInvoker.n_OnClick_Landroid_content_DialogInterface_I (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_dialog, System.Int32 which) [0x00011] in <9972d091c0994661959bc196bd63a3ee>:0 

02-14 13:11:02.239 30316 30316 I MonoDroid:   at (wrapper dynamic-method) System.Object:00444893-3a4e-4e7a-b2e0-bb65b1a03447 (intptr,intptr,intptr,int)

02-14 13:11:02.259 30316 30316 W art     : JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable

02-14 13:11:02.499  3353  3887 D GraphicsStats: Buffer count: 7

02-14 13:11:02.499  2993  4469 D libEGL  : eglTerminate EGLDisplay = 0x7f931fef88

02-14 13:11:02.499  2993  4469 D libEGL  : eglTerminate EGLDisplay = 0x7f931fef88

02-14 13:11:02.499  2993  4469 D libEGL  : eglTerminate EGLDisplay = 0x7f931fef88

02-14 13:11:02.499  2993  4469 D libEGL  : eglTerminate EGLDisplay = 0x7f931fef88

02-14 13:11:02.499  2993  3002 I SurfaceFlinger: id=420 Removed NainActivit (6/10)

02-14 13:11:02.499  3353  3863 I WindowState: WIN DEATH: Window{1fb3498 u0 d0 PinForce.Mobile/md55cfa00c4956225448383d2f3620f42f8.MainActivity}

02-14 13:11:02.509  2993  3002 I SurfaceFlinger: id=420 Removed NainActivit (-2/10)

As you can see, there is indeed a Null pointer exception as indicated by the log after that we see the WIN_DEATH log which indicates that the foreground activity was closed.

My question is why is this not classified as a regular crash (no force close dialog). Is this something specific in Xamarin ? The crash definitely happens on the UI thread. Also how can i actually print the line number for a crash stack trace. Is there a way to symbolicate the stack ?

Dibzmania
  • 1,934
  • 1
  • 15
  • 32
  • It is an unhanded exception in the Mono runtime and since the `Xamarin.Android` apps are NDK-based, poof the app/process is dead. Nothing to do with ANR thus no dialog... – SushiHangover Feb 16 '17 at 05:39
  • 1
    So you mean any exception within the mono runtime will actually not result in the force close being shown ?? Btw what do you mean by 'xamarin.android' is Android based – Dibzmania Feb 16 '17 at 06:32
  • Application Not Responding (ANR) events are about the app not responding to input or a blocked UI `Looper` (BroadcastReceiver, ...), an application *fault* is not an ANR and thus no ANR dialog. Hang the UI thread using `Xamarin.Android` or not finishing your BCR code fast enough and you get an ANR. – SushiHangover Feb 16 '17 at 06:53
  • @SushiHangover I know all about the causes of ANR. In this case I was guessing. But the stack trace I pasted clearly shows there is an exception. Just that user is not shown any prompt and the app exits silently. I am still at loss to understand this behavior – Dibzmania Feb 19 '17 at 22:01
  • It is an `unhandled exception` in *your* code, there is nothing in the Android OS or `Xamarin.Android` that will present anything to the user in that case, and thus there is nothing in the code that prevented that and provided an alternative code path or recovery and the app exits... 1) Install a crash analytics system and thus create a global exception handler to trap and report those crashes to you so you can symbolicate them and determine where the root cause is. 2) Code defensibly to avoid NRE pathways 3) Code alternative paths to allow for denied permissions, API access levels, etc... – SushiHangover Feb 20 '17 at 03:28

0 Answers0