xamarin-fingerprint
xamarin-fingerprint copied to clipboard
Android: Object reference not set to an instance of an object at Plugin.Fingerprint.Dialog.FingerprintDialogFragment.OnResume ()
Steps to reproduce
Unable to reproduce the exception on my own.
Expected behavior
There should not be a null reference exception.
Actual behavior
Receiving an exception "Object reference not set to an instance of an object". The stack-trace shows that the exception occurred on "OnResume" method but I don't have any implementation for it. I received this exception in the production environment. Completely unable to reproduce it on my own. Please see the attached crashlog for details.
Crashlog
"Error": {
"Data": {},
"ClassName": "System.NullReferenceException",
"Message": "Object reference not set to an instance of an object",
"StackTrace": [
{
"LineNumber": 0,
"ClassName": "Plugin.Fingerprint.Dialog.FingerprintDialogFragment",
"FileName": "
Configuration
Version of the Plugin: 1.4.7.0
Platform: Android 8 (API level 26)
Device: Huawei (RNE-L21)
Hi @saqibrashed,
I'm the friendly issue checker. Thanks for using the issue template :star2: I appreciate it very much. I'm sure, the maintainers of this repository will answer, soon.
Hi, for me also getting the same exception App.Xaml.cs: var result = await CrossFingerprint.Current.IsAvailableAsync(true); if (result) { try { var isAuthenticated = await CrossFingerprint.Current.AuthenticateAsync("Unlock App"); if (isAuthenticated.Authenticated) { base.OnStart(); } else { return; } } catch (Exception ex) {
throw;
}
}
MainActivity.cs: CrossCurrentActivity.Current.Activity = this; CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
Permissions:
Hi, for me also getting the same exception App.Xaml.cs: var result = await CrossFingerprint.Current.IsAvailableAsync(true); if (result) { try { var isAuthenticated = await CrossFingerprint.Current.AuthenticateAsync("Unlock App"); if (isAuthenticated.Authenticated) { base.OnStart(); } else { return; } } catch (Exception ex) {
throw;
}
}
MainActivity.cs: CrossCurrentActivity.Current.Activity = this; CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
Permissions:
I am seeing this with version 1.4.7 as well. Here is the stack trace from HockeyApp.
Xamarin caused by: android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
at Plugin.Fingerprint.Dialog.FingerprintDialogFragment.OnResume () [0x0004b] in <d1d3ad68d9a3469fb250007565ffc31f>:0
at Android.App.Fragment.n_OnResume (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <c8349fab7b1c4b3c9b17d8dc0fb8bac4>:0
at (wrapper dynamic-method) System.Object.26(intptr,intptr)
at md5f842b5ac8eb52ac6d95c95091b13caff.FingerprintDialogFragment.n_onResume(Native Method)
at md5f842b5ac8eb52ac6d95c95091b13caff.FingerprintDialogFragment.onResume(FingerprintDialogFragment.java:44)
at android.app.Fragment.performResume(Fragment.java:2657)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1319)
at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1549)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1611)
at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3039)
at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:3001)
at android.app.FragmentController.dispatchResume(FragmentController.java:200)
at android.app.Activity.performResume(Activity.java:7107)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3690)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3755)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2939)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1612)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6710)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
I can find no pattern to the type of devices affected. It seems to affect all - LG, Samsung, Pixel and runs across multiple OS versions - 8.1, 8.0. 9.0, 7.0, 5.0.
I see release mode for the Android project generates the pdb debug symbols. For future versions if you added MonoSymbolArchive set to true and made the corresponding mSYM that was generated available we could use mono-symbolicate to help track down the exact line number.
Any update on this? I'm getting the same error and is causing a crash. Any input on how to catch the exception and handle it gracefully?
Any update on this? I'm getting the same error and is causing a crash. Any input on how to catch the exception and handle it gracefully?
Unfortunately not. I haven't received any update nor have i received any answer from anyone.
@saqibrashed @sylendra7 @roberleitner @RickB864
I have fixed this issue in my application by changing this line:
CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
to this:
CrossFingerprint.SetCurrentActivityResolver(() => this);
@jlhernandez1388 Hello, how did you reproduce the crash?