smstuebe / xamarin-fingerprint

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

Authentication failed with message "FragmentManager is already executing transactions" #198

Open filipleifer opened 3 years ago

filipleifer commented 3 years ago

When Fingerprint plugin is not used on first page pushed into Navigation (NextPage in Demo) then you will get unexpected result if you try to await authentication result. If you use it on first page which is pushed into navigation (MainPage in Demo) the behaviour is correct. Demo app:

FingerPrintBugDemo.zip

Steps to reproduce

  1. Run demo app in Debug on Android device, set breakpoint to line 29 of NextPage.xaml.cs
  2. Click on button "Click" on MainPage.
  3. You get false authentication result with message "FragmentManager is already executing transactions" but fingeprint dialog is diplayed and awaiting your input in line 29 of NextPage.xaml.cs

Expected behavior

You will be awaiting the real fingerprint dialog result.

Actual behavior

You get false authentication result without wait on real result with message "FragmentManager is already executing transactions" but fingeprint dialog is still diplayed and awaiting your input.

Configuration

Version of the Plugin: Latest 2.1.2

Platform: Android 8.0 / Android 9.0

Device: Huawei P20 Lite ANE-LX1 / Sony Xperia XZ1 G8342

smsissuechecker commented 3 years ago

Hi @filipleifer,

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.

rj-thomas commented 3 years ago

Also experiencing this issue on Android 10, using latest 2.1.3

kgbuddhima commented 3 years ago

I too faced this issue

wstanczewski commented 3 years ago

I'm having the same issue, Android 11

wstanczewski commented 3 years ago

I think this issue is a duplicate of #182

wstanczewski commented 3 years ago

Using this plugin like that: var result = await Device.InvokeOnMainThreadAsync(() => CrossFingerprint.Current.AuthenticateAsync(new("",""))) solves the issue :)

Ulrizza commented 3 years ago

I have the same issue and @wstanczewski's solution is not working for me.
As a workaround I wait 500ms before calling AuthenticateAsync and it's working.

await Task.Delay(500);
var result = await Plugin.Fingerprint.CrossFingerprint.Current.AuthenticateAsync([...]);
maheshkumar1989 commented 2 years ago

Using this plugin like that: var result = await Device.InvokeOnMainThreadAsync(() => CrossFingerprint.Current.AuthenticateAsync(new("",""))) solves the issue :)

We tried this process, it worked with debug mode but it's not working in the release mode, Authentication process is not invoked. If any one has any suggestion, any help is appreciated

maheshkumar1989 commented 2 years ago

I have the same issue and @wstanczewski's solution is not working for me. As a workaround I wait 500ms before calling AuthenticateAsync and it's working.

await Task.Delay(500);
var result = await Plugin.Fingerprint.CrossFingerprint.Current.AuthenticateAsync([...]);

We tried this process. It's not working. Authentication process is not invoked. If any one has any suggestion, any help is appreciated.

IDispose commented 1 year ago

I have the same issue and @wstanczewski's solution is not working for me. As a workaround I wait 500ms before calling AuthenticateAsync and it's working.

await Task.Delay(500);
var result = await Plugin.Fingerprint.CrossFingerprint.Current.AuthenticateAsync([...]);

This is the only solution that worked. Observed that stepping thru code and waiting for a second in the debugger doesn't throw the error. Hacky, but works.

Francescolis commented 1 month ago

I had the same issue, and this code fixed it : await Task.Yield(); FingerprintAuthenticationResult result = await _fingerprint.AuthenticateAsync(request);