smstuebe / xamarin-fingerprint

Xamarin and MvvMCross plugin for authenticate a user via fingerprint sensor
Microsoft Public License
490 stars 115 forks source link

Null Refference in C:\Projekte\xamarin-fingerprint\src\Plugin.Fingerprint.Android\Dialog\FingerprintDialogFragment.cs:96 #50

Closed FilledStacks closed 7 years ago

FilledStacks commented 7 years ago

Hi Guys,

This just started happening in my latest build. I don't have a clear indication of what is causing it, but the fingerprint scanner stopped working and started throwing the following error. Maybe if you've seen this before you can give me an indication of why it's not working. It's just the basic usage of your plugin.

CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);

in my main activity

var result = await CrossFingerprint.Current.AuthenticateAsync("Use your fingerprint scanner to authenticate");

when I want to scan for a fingerprint and it crashes, with the log below. Sorry for the bad reproduce steps, i'm not doing anything fancy and it crashes.

Steps to reproduce

  1. Install the package

  2. Try basic usage

  3. Observe crash

Expected behavior

I just want the fingerprint scanning to start, Show the dialog, or with the config, just wait for a scan.

Actual behavior

Tell us what happens instead

Crashlog

System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Plugin.Fingerprint.Dialog.FingerprintDialogFragment+d19.MoveNext () [0x00032] in C:\Projekte\xamarin-fingerprint\src\Plugin.Fingerprint.Android\Dialog\FingerprintDialogFragment.cs:96 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 at Plugin.Fingerprint.Contract.AndroidFingerprintImplementationBase+d0.MoveNext () [0x00040] in C:\Projekte\xamarin-fingerprint\src\Plugin.Fingerprint.Android\Contract\AndroidFingerprintImplementationBase.cs:17 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 at Plugin.Fingerprint.Abstractions.FingerprintImplementationBase+<AuthenticateAsync>d__1.MoveNext () [0x000aa] in C:\Projekte\xamarin-fingerprint\src\Plugin.Fingerprint.Abstractions\FingerprintImplementationBase.cs:18 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 at OTP.Droid.AndroidDeviceCommandService+casync0.MoveNext () [0x0007a] in /Users/danemackier/MyFiles/Work/Clients/DevEnterprise/SharePointOTP/OTP.Droid/Services/AndroidDeviceCommandService.cs:25 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 at OTP.Shared.ViewModels.OtpViewModel+casyncC.MoveNext () [0x00054] in /Users/danemackier/MyFiles/Work/Clients/DevEnterprise/SharePointOTP/OTP.Shared/ViewModels/OtpViewModel.cs:286 --- End of inner exception stack trace --- ---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object. at Plugin.Fingerprint.Dialog.FingerprintDialogFragment+d19.MoveNext () [0x00032] in C:\Projekte\xamarin-fingerprint\src\Plugin.Fingerprint.Android\Dialog\FingerprintDialogFragment.cs:96 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 at Plugin.Fingerprint.Contract.AndroidFingerprintImplementationBase+d0.MoveNext () [0x00040] in C:\Projekte\xamarin-fingerprint\src\Plugin.Fingerprint.Android\Contract\AndroidFingerprintImplementationBase.cs:17 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 at Plugin.Fingerprint.Abstractions.FingerprintImplementationBase+d__1.MoveNext () [0x000aa] in C:\Projekte\xamarin-fingerprint\src\Plugin.Fingerprint.Abstractions\FingerprintImplementationBase.cs:18 --- End of stack trace from previous location where exception was thrown ---

If something causes an exception paste full stack trace + Exception here

Configuration

Runtime: Mono 4.8.0 (mono-4.8.0-branch/e4a3cf3) (64-bit) GTK+ 2.24.23 (Raleigh theme)

Package version: 408000495

Xamarin.Android Version: 7.1.0.41 (Xamarin Studio Community) Android SDK: /Users/danemackier/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 5.1 (API level 22) 6.0 (API level 23) 7.0 (API level 24) 7.1 (API level 25)

SDK Tools Version: 25.1.7 SDK Platform Tools Version: 24.0.1 SDK Build Tools Version: 24.0.2

Java SDK: /usr java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

Version of the Plugin: 1.4.2

Platform: Android 7.1.1

Device: e.g. LG Nexus 5x

smsissuechecker commented 7 years ago

Hi @DaneMackier,

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.

smstuebe commented 7 years ago

Looks like the current activity is null. Have you set up the current activity plugin correctly? You have to add a Application.cs like: https://github.com/jamesmontemagno/CurrentActivityPlugin/blob/master/tests/CurrentActivityTest.Droid/MainApplication.cs

FilledStacks commented 7 years ago

@smstuebe Thanks for your response, I was setting that in the app, something weird was happening in between then and calling the plugin. So no now I set it just before calling. It's working now. Thank you