Bug 54998 - [VS-Mac][7.0 build 2770][Mac App]- Unable to deploy Mac App in release mode with Target Framework as "Unsupported Framework" in El Capitan 10.11.6
Summary: [VS-Mac][7.0 build 2770][Mac App]- Unable to deploy Mac App in release mode w...
Status: RESOLVED ANSWERED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: mmp ()
Version: 3.4.0 (15.2)
Hardware: PC Mac OS
: Normal major
Target Milestone: 15.2
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-04-11 07:26 UTC by Gaurav Ganorkar
Modified: 2017-06-22 06:58 UTC (History)
7 users (show)

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


Attachments
Release mode Errors Screenshot and IDE logs (582.20 KB, application/zip)
2017-04-11 07:26 UTC, Gaurav Ganorkar
Details


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:
Status:
RESOLVED ANSWERED

Description Gaurav Ganorkar 2017-04-11 07:26:16 UTC
Created attachment 21413 [details]
Release mode Errors Screenshot and IDE logs

Description
-Sample Mac app template is able to deploy in DEBUG mode with target framework as "Unsupported Framework" but same template we are unable to deploy in RELEASE mode only in EL Capitan 

Test Environment
-https://gist.github.com/ganorkargaurav/4d52b8792178ea3bcf01363772213e6a

Precondition
-Mac OS with El Capitan 10.11.6 is required

Steps to reproduce
1-Create a mac app project
2-Select Config as Release mode
3-Deploy and Observe the Errors

Actual
-Getting incompatibility error given "error MM4162: The type 'AVFoundation.AVContentKeyRequest' (used as a parameter in AVFoundation.AVContentKeySession.RenewExpiringResponseData) is not available in macOS 10.12.2 (it was introduced in macOS 10.12.4). Please build with a newer macOS SDK (usually done by using the most recent version of Xcode)."

Observation
-Same Project is getting deploy in Debug mode with same configuration

Reproducible
-100%

Gist Build Output
-https://gist.github.com/ganorkargaurav/a1b7397559c4ca6bc7bf9410a87e2854
Comment 1 Gaurav Ganorkar 2017-04-17 06:43:33 UTC
Note-
On OS El Capitan we are facing this issue with Config given below
-Mac Application in Release mode + Targeted Framework as Unsupported OR Xamarin.Mac .Net 4.5 Framework
Comment 2 Marcus Ball 2017-04-17 17:09:45 UTC
This morning I just mindlessly clicked through the Xamarin update prompt and am now experiencing this issue, too. 

Mac OS Sierra, 10.12.3. Same configuration as above: Release build using Xamarin.Mac .Net 4.5 Framework
Comment 3 Pati Szelag 2017-04-26 08:29:13 UTC
I made exactly the same mistake and updated my Xamarin Studio and I cannot build in Release config any more - same errors.

Error MM4162: The type 'AVFoundation.AVContentKeyRequest' (used as a parameter in AVFoundation.AVContentKeySession.RenewExpiringResponseData) is not available in macOS 10.12.2 (it was introduced in macOS 10.12.4). Please build with a newer macOS SDK (usually done by using the most recent version of Xcode).<--- (MM4162) (projname) ---> (Inner Exception #0)

28 build errors.
Comment 4 Chris Hamons 2017-04-26 14:23:41 UTC
So these errors are expected given your setup, but the confusion is understandable. First the solution. Either:

- Upgrade to 10.12 and Xcode 8.3 OR
- If you are using Xamarin.Mac Mobile (Modern) Target Framework (https://developer.xamarin.com/guides/mac/advanced_topics/target-framework/) you can enable link SDK OR
- Add --registrar:dynamic to your Project Options -> Mac Build -> Additional MMP Arguments

Now let me explain how we got here:

- In Xamarin.Mac 3.2 the default behavior for Release mode builds was changed (https://developer.xamarin.com/releases/mac/xamarin.mac_3/xamarin.mac_3.2/#Release_Mode_MMP_Default_Changes) to include use of the static registrar. This drastically improves launch time performance.
- When linking is disabled, the static registrar links in every binding type, which requires use of the latest Xcode when building, which would be Xcode 8.3
- Xcode 8.3 requires macOS 10.12 (https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html)
- So we can either disable the static registrar, use the newer Xcode, or enable linking to strip away these types if unneeded.

I believe we can message this condition better, so I've filed a separate bug for that:

https://bugzilla.xamarin.com/show_bug.cgi?id=55622
Comment 5 Denis Rotanov 2017-06-22 06:54:39 UTC
Hello. I've encountered the same issue.

However enabling link Framework SDKs only breaks application in runtime due to heavy usage of reflection by MEF. Is there any way to find out what exactly to force linking?

You don't always have an option to upgrade XCode or MAC OS e.g. on deploy machines.
Comment 6 Denis Rotanov 2017-06-22 06:58:29 UTC
well, --registrar:dynamic solved the issue.

however with following runtime error message:

objc[46477]: Class VCWeakObjectHolder is implemented in both /System/Library/PrivateFrameworks/AVConference.framework/Frameworks/ViceroyTrace.framework/Versions/A/ViceroyTrace (0xa64ca090) and /System/Library/PrivateFrameworks/AVConference.framework/Versions/A/AVConference (0xa64e0ea4). One of the two will be used. Which one is undefined.