Bug 58907 - Xamarin.Mac 3.6.0 breaks App Store compatibility
Summary: Xamarin.Mac 3.6.0 breaks App Store compatibility
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Runtime ()
Version: 3.6.0 (d15-3)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-08-19 23:39 UTC by Ivan Icin
Modified: 2017-08-23 18:43 UTC (History)
2 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 Ivan Icin 2017-08-19 23:39:43 UTC
After upgrading to Xamarin.Mac 3.6 I get this error: "Deprecated API Usage - Apple no longer accepts submissions of apps that use QuickTime or QTKit APIs."

Downgrading to Xamarin.Mac 3.4 resolves the problem so it is definetely 3.6 that has some bug.
Comment 1 Chris Hamons 2017-08-21 14:03:12 UTC
So I believe you are submitting an application which is using the dynamic registrar and/or not linking.

I wrote up an explanation here:


Depending on the version of Xamarin.Mac you want to use, passing --linkplatform or --registrar:dynamic to mmp via the "Additional MMP Arguments" (found in project settings -> Mac Build) should fix that.

Please update the bug with news on how that submissions is judged.
Comment 2 Ivan Icin 2017-08-21 14:14:15 UTC
I am aware of that. I couldn't submit my app two or three months ago without resolving that, but then it worked until 3.6. Now it doesn't work. It is something else, I do have --registrar:dynamic in MMP arguments.
Comment 3 Chris Hamons 2017-08-21 18:26:09 UTC
I'm having some difficulty following your description, but I believe the following is true:

- At some point Apple began to refuse any macOS App Store submission that linked against QTKit
- By default Xamarin.Mac links against all system frameworks, as you can invoke APIs from all frameworks using it.
- Linking, or "tree shaking" as it sometimes is called, analyzes your application to determine what is unused so it can be removed.
- Linked applications that do not use QTKit will not link against it, and thus can be submitted.
- However, linking requires certain constraints to be held, one of which is a call graph that is consistent and mostly static (reflection cases need to be marked with [Preserve] attributes).
- System.Configuration, part of the Full BCL library but not included in Modern, uses reflection in many places, and is unsafe for linking.

None of the above diffs to my knowledge between XM versions.

In Xamarin.Mac 3.2 a default was changed from --registrar:dynamic to --registrar:static for release builds. This significantly improved startup speed for applications, but forces a hard reference to QTKit that Apple notices and rejects.

One option is to add --registrar:dynamic which reverts is to the old 3.2 behavior. 

A second option on newer XMs is to use --linkplatform . That runs a limited form of linking only against Xamarin.Mac.dll which was designed for this use case. If your application does not use QTKit, the XM calls will be linked out and the static registrar will no longer create a hard reference.
Comment 4 Ivan Icin 2017-08-21 19:17:49 UTC
Chris, thanks for the detailed description.

My app did work and works still on Xamarin.Mac 3.4. It uses --registrar:dynamic as you have suggested. On Xamarin.Mac 3.6 it doesn't work. As far as I understand this makes no logical sense for you and that's why it is hard for you to follow, but it is as simple as that - the same code works on Xamarin.Mac 3.4 (simple reverting from 3.6 to 3.4 makes it work again, upgrade makes it fail).

Should I try to use --linkplatform instead of --registrar:dynamic?
Comment 5 Chris Hamons 2017-08-21 19:23:47 UTC
Without a sample to review, or a full build log at least, it is difficult if not impossible to what the problem is.

You can try --linkplatform for sure, as that is the more ideal solution (you get faster startup time and don't link against QTKit).

Or you can provide me more information about the 3.6 + dynamic registrar use case. I believe that should be working, so something else is going on.
Comment 6 Ivan Icin 2017-08-21 20:44:57 UTC
You might find useful that with --linkplatform build fails and I get this error:

Error MM2001: Could not link assemblies. Reason: Error processing method: 'System.Data.Services.Client.DataServiceResponse Microsoft.WindowsAzure.Storage.Table.DataServices.TableServiceContext/<>c__DisplayClass5::<GenerateSaveChangesCommand>b__3()' in assembly: 'Microsoft.WindowsAzure.Storage.dll' (MM2001) 
I feel like that it might be the key for overall problem.
Comment 7 Chris Hamons 2017-08-21 21:07:43 UTC
As I mentioned before, without a sample to review, or a full build log, it is very difficult to determine what the problem is.

It sounds like an assembly you are using, Microsoft.WindowsAzure.Storage.dll, is not playing nicely with our linker. This is possibly a bug.

Please provide a sample showing the issue at hand, or at least a full build log.
Comment 8 Ivan Icin 2017-08-21 22:01:28 UTC
OK, here is the full log for the --registrat:dynamic version: https://pastebin.com/5sbg5SP7
Comment 9 Ivan Icin 2017-08-22 10:43:56 UTC
I was able to compile the project by replacing desktop dll with portable dll for Microsoft.WindowsAzure.Storage.dll and using --linkplatform, so in some way the problem is resolved for me (OK I'll have to upload to confirm that there is no problem but this looks promising), though I think that there might be indications of some bugs in Xamarin from the problems I have described and if you are willing to take on them I can make further reports.

Just to note that other Azure dlls work only when using the desktop version as iOS version uses UIKit, but they don't break the linker.
Comment 10 Chris Hamons 2017-08-22 20:50:57 UTC
The Error MM2001 bug definitely deserves further research, but as it is rather assembly dependent, we'll need a project sample showing the bug to proceed on it.

Thinking about it, maybe --linkplatform should be default for XM Full profiles.