Bug 11573 - non-public API/S in your App when build option set to "Don't Link"
Summary: non-public API/S in your App when build option set to "Don't Link"
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.1.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2013-04-04 04:27 UTC by Marc Van Laer
Modified: 2013-04-23 10:13 UTC (History)
3 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 Marc Van Laer 2013-04-04 04:27:36 UTC
We got the following comment after an upload in Apple Store (iTunes):

We found the following non-public API/s in your app:


With "strings" & "tool" we find those references in the following dll:


After a long try and error we came up with the following diagnose:

Compiling and building an IOS App with "Don't Link" option will create the existence of those non-public API/s
Compiling and building an IOS APP with "Link SDK assemblies only" will remove those non-public API/s

The problem is however that we have an App with external dll's were we have to set the option "Don't Link" when building the App. Also setting the build option to "Don't Link" in a random project (already in the App store - not using any external dll's) will create the same references to those non-public API/s.

How can we fix/avoid  this?
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-04-04 07:21:46 UTC
It is not recommended to not link your app, since the app size will be significantly bigger than when you're linking (either all assemblies or just sdk assemblies).

The recommended way to fix this is to be more fine-grained when specifying what you want to keep in the app, and this process is described under "Custom Linking" here: http://docs.xamarin.com/guides/ios/advanced_topics/linker.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2013-04-04 07:23:36 UTC
Note that video:didFinishSavingWithError:contextInfo: shows up in Apple's documentation here: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIKitFunctionReference/Reference/reference.html#//apple_ref/c/func/UIImageWriteToSavedPhotosAlbum - so it is odd that Apple flags this selector as non-public. The other two are non-public.
Comment 3 Marc Van Laer 2013-04-04 07:31:20 UTC
Well Rolf,

I understand exactly what you mean by "It is not recommended to not link your app", but we are in the middle of a situation were we have to use a 3rd party Lib on which we do not have any control. 

It is still odd though that those non-public API/s are not sitting in the 3rd party library, but in monotouch.dll itself. Even a build with almost nothing in the application then "Hello World" is generating this.
Comment 4 Sebastien Pouliot 2013-04-04 10:18:15 UTC
> we have to use a 3rd party

That should not be an issue. Link SDK (default) won't modify 3rd party code (only the code that Xamarin provides).

> on which we do not have any control.

You still have some control. E.g. if the 3rd party library depends on something (e.g. thru reflection) removed from the SDK assemblies then it can be preserved using other methods (like an XML file).

Using "Don't link" should *only* be used to debug issues (e.g. confirm if something is related to the linker) and never to release applications. You're missing tons of optimizations (in the bindings) that slows down your application and make it a lot larger that it needs to be,

> Even a build with almost nothing in the application then "Hello World" is generating this.

That's normal. If you select "Don't link" then monotouch.dll won't be processed (it's an SDK assembly) and you'll be using the "full" monotouch.dll.

Now monotouch.dll contains *all *the bindings for iOS API that Apple provides. If one of Apple's ObjC selectors is changed to be "private" then it will be part of the final executable.
Comment 5 Marc Van Laer 2013-04-04 12:13:39 UTC
Seams that everything is working as designed then! 

Message understood, Loud and clear.

In the meantime... We are working on a build were we can use the 3rd party library in a "Link SDK assemblies only", as they will never be able to use their lib on IOS anyway in "Don't Link" mode!

Txs for the support!
Comment 6 Rolf Bjarne Kvinge [MSFT] 2013-04-23 10:13:13 UTC
This has been fixed.

monotouch master: b3c67fa2194fc0106335eeb9bbef0779701e036c and 3f5242994c0a0abaee48e289b4677120ae9987a4.

Unfortunately I can't say right now which version of Xamarin.iOS will include these fixes.