Bug 42473 - Incremental builds + third-party assemblies with native libraries don't build correctly
Summary: Incremental builds + third-party assemblies with native libraries don't build...
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: (C9)
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2016-07-11 23:21 UTC by Udi
Modified: 2017-01-10 09:31 UTC (History)
6 users (show)

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

Simple project to reproduce (21.02 KB, application/zip)
2016-07-21 15:41 UTC, Bill Holmes

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 Udi 2016-07-11 23:21:09 UTC
When trying to use DACircularProgress (https://components.xamarin.com/view/DACircularProgress), in a project with storyboard, an exception is thrown.

The exception thrown:

Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Please file a radar on UIKit if you see this assertion.
Native stack trace:
	0   CoreFoundation                      0x228bf883 <redacted> + 150
	1   libobjc.A.dylib                     0x34272dff objc_exception_throw + 38
	2   CoreFoundation                      0x228bf741 <redacted> + 0
	3   Foundation                          0x2364f307 <redacted> + 86
	4   UIKit                               0x2707ceb5 <redacted> + 480
	5   UIKit                               0x2707d45b <redacted> + 14
	6   UIKit                               0x26cbbd81 <redacted> + 44
	7   UIKit                               0x26b5651f <redacted> + 702
	8   UIKit                               0x27078c99 <redacted> + 1220
	9   UIKit                               0x2707837b <redacted> + 1234
	10  UIKit                               0x26a86847 <redacted> + 30
	11  UIKit                               0x26a86823 <redacted> + 30
	12  UIKit                               0x26cca889 <redacted> + 52
	13  UIKit                               0x26cca805 <redacted> + 252
	14  UIKit                               0x269d7243 <redacted> + 30
	15  UIKit                               0x26cca6f3 <redacted> + 142
	16  UIKit                               0x269ccf9d <redacted> + 1408
	17  UIKit                               0x269cccff <redacted> + 738
	18  UIKit                               0x269cc471 <redacted> + 124
	19  UIKit                               0x269cc317 <redacted> + 426
	20  UIKit                               0x269d8de7 <redacted> + 1606
	21  UIKit                               0x269d879b <redacted> + 30
	22  UIKit                               0x269d7fa1 <redacted> + 496
	23  UIKit                               0x269d537f <redacted> + 286
	24  UIKit                               0x26a4824d <redacted> + 48
	25  UIKit                               0x26c6564d <redacted> + 3320
	26  UIKit                               0x26c693f7 <redacted> + 1554
	27  UIKit                               0x26c7c381 <redacted> + 36
	28  UIKit                               0x26c6691f <redacted> + 134
	29  FrontBoardServices                  0x2aa29ccd <redacted> + 232
	30  FrontBoardServices                  0x2aa29fb9 <redacted> + 44
	31  CoreFoundation                      0x22882827 <redacted> + 14
	32  CoreFoundation                      0x22882417 <redacted> + 454
	33  CoreFoundation                      0x2288077f <redacted> + 806
	34  CoreFoundation                      0x227d31e9 CFRunLoopRunSpecific + 516
	35  CoreFoundation                      0x227d2fdd CFRunLoopRunInMode + 108
	36  UIKit                               0x26a3d43f <redacted> + 526
	37  UIKit                               0x26a3818d UIApplicationMain + 144
	38  libXamarin.iOS.dll.dylib            0x0049aa34 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 252
	39  libXamarin.iOS.dll.dylib            0x004615dc UIKit_UIApplication_Main_string___intptr_intptr + 52
	40  libXamarin.iOS.dll.dylib            0x0046159c UIKit_UIApplication_Main_string___string_string + 204
	41  libTestRadial.exe.dylib             0x0042aabc TestRadial_Application_Main_string__ + 188
	42  libmscorlib.dll.dylib               0x00668468 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 256
	43  libmonosgen-2.0.dylib               0x00198ea9 mono_jit_runtime_invoke + 1588
	44  libmonosgen-2.0.dylib               0x001ec7a3 mono_runtime_invoke + 102
	45  libmonosgen-2.0.dylib               0x001efffb mono_runtime_exec_main + 284
	46  libxamarin-debug.dylib              0x003fb408 xamarin_main + 2232
	47  TestRadial                          0x00022bb3 main + 112
	48  libdyld.dylib                       0x3499d873 <redacted> + 2
Comment 1 Bill Holmes 2016-07-15 20:40:58 UTC
I am not able to reproduce.  Can you please provide a sample that shows the issue?
Comment 2 Udi 2016-07-15 21:11:27 UTC
Please note that this happens only on a real device.

Demo project can by downloaded from here (i'ts 9 MB so I couldn't upload it here):
Comment 3 Bill Holmes 2016-07-16 01:27:14 UTC
Thanks for that.  I can see the crash now.
Comment 4 Udi 2016-07-21 10:08:10 UTC
Do you know when and if this will be fixed? It's for an app, and I need to decide weather to wait or search for an alternative.
Comment 5 Bill Holmes 2016-07-21 15:00:18 UTC
I do not.  It is not clear if this is a bug with the Xamarin.iOS designer, Xamarin.iOS itself or DACircularProgress.  

From what I have been able to determine setting up appearance of the DACircularProgressView is the key to this bug.  


If you remove this code the app will not crash.  It will not look right, but it will not crash.

If you are interested in looking at the bug while we do, here is the binding code for DACircularProgress.

Comment 6 Bill Holmes 2016-07-21 15:37:04 UTC
We have identified a workaround.  Disabling incremental builds for your app project will remove the exception.  

Project Options -> iOS Build -> Enable incremental builds checkbox.
Comment 7 Udi 2016-07-21 15:40:08 UTC
Will try it now, thanks. BTW, disabling incremental builds was also the solution for problems I've had recently with other libraries such as Google Ads and Google Analytics.
I will update shortly if it resolved the issue.
Comment 8 Bill Holmes 2016-07-21 15:41:07 UTC
Created attachment 16746 [details]
Simple project to reproduce

It was found that when building on device with incremental builds enabled a warning appears in the device log.

Class DACircularProgressLayer is implemented in both .../AnotherTest.app/libDACircularProgress.dll.dylib and .../AnotherTest.app/AnotherTest. One of the two will be used. Which one is undefined.

When incremental builds are disabled, there is no libDACircularProgress.dll.dylib in the app and the app runs fine.
Comment 9 Udi 2016-07-21 15:53:36 UTC
Just tested the initial project which crashed, and it does work without incremental builds. Thanks!
Comment 10 Rolf Bjarne Kvinge [MSFT] 2016-10-31 17:12:46 UTC
PR: https://github.com/xamarin/xamarin-macios/pull/1073
Comment 12 Naqeeb 2016-11-21 13:40:40 UTC
I have checked this issue with latest master build and observed that it is working fine. Here is the screencast for the same: http://www.screencast.com/t/mJR9LqUs1

Environment info: https://gist.github.com/NaqeebAnsari/3b13c09a60a5863ed51abda3ffb9c3a9

Please merge the fix in C9, so that we can verify with C9 build.
Comment 13 Danish Akhtar 2016-12-28 05:59:48 UTC
I have checked this issue with latest C9 builds using the sample provided in Comment 8 and observed that application is deployed successfully on iOS device but I am not able to check warning message in device log window. Due to Bug 50993.

I'll verify this issue, Once Bug 50993 gets Resolved.
Comment 14 Danish Akhtar 2017-01-10 09:31:44 UTC
I have checked this issue with latest C9 XS 6.2(build 1718) and with master XS 6.3(build 492) and observed that now this issue is not exists, sample provided in Comment 8 is build successfully.

I am not getting any warning message mentioned in Comment 8 in device log.

Hence closing this issue.