xamarin-fingerprint icon indicating copy to clipboard operation
xamarin-fingerprint copied to clipboard

Crash with 2.1.5 in UWP on checking availability, same code works with 2.1.5 on Android, and on all platforms with 2.1.4

Open AnEnglishmanInNorway opened this issue 2 years ago • 4 comments

I have a Xamarin app using that has been operational on Android and UWP for some years, and which uses this really useful plugin for fingerprint authentication. I've kept all the underlying packages up-to-date, building and publishing it to my users about every 3 months. I'm doing an update round now and am current on everything except the fingerprint plugin which is currently on version 2.1.4 - and everything works as expected. BUT if I configure in fingerprint 2.1.5, make NO other changes, clean and rebuild the (VS2019) solution, then the Android version works fine (at least on the emulator) while the UWP version crashes with a not implemented exception (coming from CreateFingerprint) ** Update 14.apr.2022: I had a quick look at the fingerprint code. The exception is deliberate:

        static IFingerprint CreateFingerprint()
        {
#if NETSTANDARD2_0
            throw NotImplementedInReferenceAssembly();
#else
            return new FingerprintImplementation();
#endif
        }

but as far as I can see this code has not been changed since 2018, so I don't see what has happened between 2.1.4 and 2.1.5 to suddenly create the problem. I searched for UWP and .NET Standard, and there is a lot of aggro out there about the fact that UWP is not moving - but why that affects this, I don't know.

For info, I have just completed my move from VS2019 (where I discovered this issue) to VS2022, and the issue appears to be identical there.

Steps to reproduce

Just start the program! If I don't get an quick answer on the lines of "Oops, that's obvious", then I'll try making a tiny app to reproduce the problem

Expected behavior

I'm testing for fingerprint availability:

            var fingerprintAvailability = await CrossFingerprint.Current.GetAvailabilityAsync().ConfigureAwait(true);
            m_ViewModel.HasFingerprintScan = (fingerprintAvailability == FingerprintAvailability.Available);

I have read that I can't expect "true" to work on UWP, but in all releases up to now it has just been ignored. To be sure, I commented out this code, and set HasFingerprintScan explicitly (to true, though I don't actually have a scanner on my PC, just so I could hit a button to call more fingerprint code). Doing that gave me the same exception, so I wonder if maybe there is perhaps a new check on the existence of the scanner which has accidentally kicked in when I try to find out myself about scanner availability!

Actual behavior

Crash...

Unhandled exception at 0x05E062E1 (Windows.UI.Xaml.dll) in PGXF.UWP.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x110191D8, 0x00000002).
This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.

Crashlog

   at Plugin.Fingerprint.CrossFingerprint.CreateFingerprint() in /_/src/Plugin.Fingerprint/CrossFingerprint.cs:line 32
   at System.Func`1.InvokeOpenStaticThunk()
   at PGXF.MainPage.<CheckFingerprintAvailability>d__16.MoveNext() in D:\Users\pete\Documents\My Coding!\PasswordGeneratorV2\PGXF\PGXF\PGXF\MainPage.xaml.cs:line 202
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in f:\dd\ndp\fxcore\CoreRT\src\System.Private.CoreLib\src\System\Runtime\ExceptionServices\ExceptionDispatchInfo.cs:line 63
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.CoreLib\shared\System\Runtime\CompilerServices\TaskAwaiter.cs:line 186
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.CoreLib\shared\System\Runtime\CompilerServices\TaskAwaiter.cs:line 154
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.CoreLib\shared\System\Runtime\CompilerServices\TaskAwaiter.cs:line 125
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult() in f:\dd\ndp\fxcore\CoreRT\src\System.Private.CoreLib\shared\System\Runtime\CompilerServices\TaskAwaiter.cs:line 109
   at PGXF.MainPage.<OnLoaded>d__10.MoveNext() in D:\Users\pete\Documents\My Coding!\PasswordGeneratorV2\PGXF\PGXF\PGXF\MainPage.xaml.cs:line 86
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in f:\dd\ndp\fxcore\CoreRT\src\System.Private.CoreLib\src\System\Runtime\ExceptionServices\ExceptionDispatchInfo.cs:line 63
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_0(Object state) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncMethodBuilder.cs:line 931
   at System.Action`1.Invoke(T obj)
   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore() in f:\dd\ndp\fxcore\CoreRT\src\System.Private.CoreLib\src\System\Threading\SynchronizationContext.WinRT.cs:line 81

Configuration

My PC is fully up-to-date:

  • OS Name Microsoft Windows 10 Pro
  • Version 10.0.19044 Build 19044
  • System Type x64-based PC
  • System SKU LENOVO_MT_80RU_BU_idea_FM_Lenovo ideapad 700-15ISK
  • Processor Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz, 2304 Mhz, 4 Core(s), 4 Logical Processor(s)
  • BIOS Version/Date LENOVO E5CN63WW, 14/06/2018
  • SMBIOS Version 2.8

My Visual Studio 2019 is also up-to-date, 16.11.11

I cleared all the Nuget caches, removed all the bin and obj directories for the projects in my solution, and rebuilt with no change in the crash behaviour.

The plugin is configured in to all the projects in the solution - platform independent and platform dependent - and the git changes window shows that the 2.1.5 version has been put in to all the .csproj files

AnEnglishmanInNorway avatar Apr 07 '22 15:04 AnEnglishmanInNorway

Hi @AnEnglishmanInNorway,

I'm the friendly issue checker. It seems like (37.50 %) you haven't used our issue template :cry: I think it is very frustrating for the repository owners, if you ignore them.

If you think it's fine to make an exception, just ignore this message. But if you think it was a mistake to delete the template, please close the issue and create a new one.

Thanks!

smsissuechecker avatar Apr 07 '22 15:04 smsissuechecker

I have the same issue under UWP

muenchris avatar Apr 11 '22 20:04 muenchris

Edit: different issue, investigating and may open new issue

Old details I have a similar issue with a MAUI app.

Launches fine on android but I get a This functionality is not implemented in the portable version of this assembly. error on Windows.

Code

var request = new AuthenticationRequestConfiguration("Prove you have fingers!", "Because without it you can't have access")
{
    AllowAlternativeAuthentication = true
};

var result = await CrossFingerprint.Current.AuthenticateAsync(request); // <-- THIS ERRORS

Edit: Sorry mine doesn't work on 2.1.4, shall I open a new issue even though the error message is the same

glenn2223 avatar May 09 '22 14:05 glenn2223

Any Updates?

chaoyebugao avatar May 13 '22 23:05 chaoyebugao