Bug 53673 - Use of LAContext requires LocalAuthentication framework linked in
Summary: Use of LAContext requires LocalAuthentication framework linked in
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: mmp ()
Version: Master
Hardware: PC Mac OS
: High normal
Target Milestone: 15.3
Assignee: Bugzilla
Depends on:
Reported: 2017-03-21 18:07 UTC by Chris Hamons
Modified: 2017-08-01 02:51 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Chris Hamons 2017-03-21 18:07:28 UTC

I am unsure if it is safe to unconditionally do this (does that break app store submission if you don't need it) and we'll need a feature flag / scan for use of some APIS or not.
Comment 1 Sebastien Pouliot 2017-03-22 16:26:51 UTC
> I am unsure if it is safe to unconditionally do this

This is what we have been doing, for macOS, for all other frameworks. It's a bit different for iOS so I think you need to have a document with a checklist so it's not forgotten.

> does that break app store submission if you don't need it 

^ is that a question ? or a fact ?

That's a problem with not linking :( e.g. HealthKit have in some, not every, cases caused issue if you don't link.

Maybe we should look at allowing linking on Xamarin.Mac.dll *only* (not SDK) for non-mobile profiles. At least we know System.Configuration is not used by XM itself. That should also speed up initialization (even if having the static registrar already solved much of that issue).

> we'll need a feature flag / scan for use of some APIS or not.

I'd rather not as this is tricky, e.g. SRE/dynamic loading means scanning at build time is not enough.
Comment 2 Chris Hamons 2017-03-22 16:29:43 UTC
It was an open question @Sebastien - I just didn't want to add LocalAuthentication to the link list without at least a quick test that it wouldn't break submitting to the app store (Like HealthKit).

Interesting idea of allowing linking of XM.dll itself on Full. Let me make a trello card for that idea.
Comment 3 Sebastien Pouliot 2017-03-23 14:52:41 UTC
@Chris ok, please double check but I don't think we have QA submission tests for the mac store (and that would be a good addition).

In the meantime either we include this (like other before) or minimally add the workaround inside the bug report.
Comment 6 David Lilley 2017-04-04 09:19:19 UTC
I am not fully clear what goes on the internals here, but let me throw what I have seen in to the mix as it might help.

using --link_flags="-framework LocalAuthentication" to get it working on 10.12, this works nicely. However when packaging it up and using the same package on machine before  Local Authentication API eg 10.8

I am presented with a error prompt with the following :

Process:         Banking 4X [1322]
Path:            /Applications/Banking 4X.app/Contents/MacOS/Banking 4X
Identifier:      com.Subsembly.Banking4X
Version:         6.4.3 (6290)
Code Type:       X86-64 (Native)
Parent Process:  launchd [118]
User ID:         501

Date/Time:       2017-04-04 11:06:24.380 +0200
OS Version:      Mac OS X 10.8.5 (12F45)
Report Version:  10

Interval Since Last Report:          174491 sec
Crashes Since Last Report:           26
Per-App Interval Since Last Report:  6479 sec
Per-App Crashes Since Last Report:   6
Anonymous UUID:                      8F3AB1ED-C57D-1762-E718-2AE969985161

Crashed Thread:  0

Exception Codes: 0x0000000000000002, 0x0000000000000000

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Library not loaded: /System/Library/Frameworks/LocalAuthentication.framework/Versions/A/LocalAuthentication
  Referenced from: /Applications/Banking 4X.app/Contents/MacOS/Banking 4X
  Reason: image not found

Binary Images:
       0x10b057000 -        0x10b407fff +com.Subsembly.Banking4X (6.4.3 - 6290) <6C66C0C3-EBFD-341F-B7DC-AB976C1F85D7> /Applications/Banking 4X.app/Contents/MacOS/Banking 4X
    0x7fff6ac57000 -     0x7fff6ac8b94f  dyld (210.2.3) <8958FE97-5830-3928-BC38-23136E7D3783> /usr/lib/dyld
    0x7fff92338000 -     0x7fff92f65fff  com.apple.AppKit (6.8 - 1187.40) <F12CF463-6F88-32ED-9EBA-0FA2AD3CF576> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
    0x7fff94e0b000 -     0x7fff94f00fff  libiconv.2.dylib (34) <FEE8B996-EB44-37FA-B96E-D379664DEFE1> /usr/lib/libiconv.2.dylib

Model: iMac12,1, BootROM 10.4.0 (29337) rev 0, 2 processors, 2.5 GHz, 4 GB, SMC 1.30f1
Graphics: Display, PCI, 32 MB
Network Service: Ethernet, Ethernet, en0
Serial ATA Device: OS X-0, 68.72 GB
Serial ATA Device: Virtual DVD-ROM [1]
USB Device: FaceTime HD Camera (Built-in), 0x203a, 0xfff9, 0xfd300000 / 4
USB Device: Virtual Mouse, 0x203a, 0xfffc, 0xfd100000 / 3
USB Device: Virtual Keyboard, apple_vendor_id, 0x0221, 0xfd200000 / 2
Comment 7 Sebastien Pouliot 2017-04-04 13:04:49 UTC
@David if you want to use the application in a version of macOS that did *not* have the framework then you must use `-weak-framework`, e.g.

> --link_flags="-weak_framework LocalAuthentication"
Comment 8 Sebastien Pouliot 2017-08-01 02:51:03 UTC
AFAICT this is part of 3.6 [1] and noted in the release notes.
@Chris please update if something was missing.

[1] https://developer.xamarin.com/releases/mac/xamarin.mac_3/xamarin.mac_3.6/