This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 44701 - Could not link assemblies. Reason: Object reference not set to an instance of an object iOS 10.0 Xamarin
Summary: Could not link assemblies. Reason: Object reference not set to an instance of...
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll (show other bugs)
Version: XI 10.0 (iOS10)
Hardware: PC Mac OS
: Normal normal
Target Milestone: (C9)
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2016-09-23 19:30 UTC by Rafael Nicolett
Modified: 2016-12-12 17:11 UTC (History)
6 users (show)

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


Attachments
Could not link assemblies. Reason: Object reference not set to an instance of an object (6.71 MB, text/rtf)
2016-09-23 19:30 UTC, Rafael Nicolett
Details

Description Rafael Nicolett 2016-09-23 19:30:15 UTC
Created attachment 17719 [details]
Could not link assemblies. Reason: Object reference not set to an instance of an object

I have problems when build iOS Releases with Link SDK Only Assemblies is activated:

Could not link assemblies. Reason: Object reference not set to an instance of an object
Comment 1 Sebastien Pouliot 2016-09-23 19:33:25 UTC
Thanks, but we'll need more than logs. Can you share a test case (or your application) so we can duplicate the issue ?
Comment 2 Rafael Nicolett 2016-09-23 19:58:08 UTC
How could I share you a case testing?

It's my first post of bug Xamarin, could help me to send you more information?
Comment 3 Sebastien Pouliot 2016-09-23 20:08:56 UTC
@Rafael, you can attach a small* test case directly to the bug report. You can mark is as private so it won't be visible publicly (but only to Xamarin/MS employees).

* if the test case can not fit into bugzilla limit you can give us a link (to dropbox, google drive...) where we can download it. Again you can put the comment as private so the link won't be visible publicly.
Comment 4 Rafael Nicolett 2016-09-23 20:50:41 UTC
@Sebastien

I can add you to my team in the Visual Studio Online Git to access the project, we can do this?
Comment 5 Sebastien Pouliot 2016-09-23 21:00:04 UTC
Never tried it (mac only here), but github and other worked fine so I assume this one would too.
Comment 6 Rafael Nicolett 2016-09-23 21:03:02 UTC
Ok it's git user into Visual Studio Online platform, you send e-mail to I add you into our team?
Comment 7 Claudio Redi 2016-09-26 18:23:31 UTC
@Sebastien, please share your finds here as I'm also looking for a solution for this.
Comment 8 Sebastien Pouliot 2016-09-27 12:50:05 UTC
I can duplicate the issue using Rafael's project. I'll update the bug report once fixes becomes available. Thanks!
Comment 9 Sebastien Pouliot 2016-09-27 14:05:13 UTC
GoogleConversionTracking.Unified.dll contains some extra, unneeded code, generated by the C# compiler*, e.g.

IL_002f: stloc.0
IL_0030: ldloc.0

which the binding optimizer did not expect.


* maybe just lacking `/optimize` with an old `csc` compiler. Mono's `mcs` never generated that code pattern.

The workaround (for the current stable XI) is to add

> --linkskip=GoogleConversionTracking.Unified

to your *Additional mtouch arguments* of your main project. That will turn off linking only for that assembly (which does not have a lot of managed code to optimize anyway).
Comment 10 Claudio Redi 2016-09-27 14:19:53 UTC
@Sebastien, good find :) Do I have any way to know what's the offensive assembly in my case? I don't see that dll in my project.
Comment 11 Sebastien Pouliot 2016-09-27 15:30:32 UTC
@Claudio Right now* the easiest way would be to do a "binary search" using `--linkskip=XXX` on your binding assemblies.

* I'm looking (separately) into adding more specific errors for such errors.
Comment 12 Sebastien Pouliot 2016-09-27 16:16:36 UTC
PR (master) https://github.com/xamarin/xamarin-macios/pull/900
Comment 13 Sebastien Pouliot 2016-09-27 20:35:15 UTC
Merged in xamarin-macios/master commit da60263a0a94f38d56d554eab90962beb5283b63
Comment 14 Claudio Redi 2016-09-27 20:53:00 UTC
Thanks @Sebastien, I was able to find the offending assembly. Thanks for your assistance.
Comment 17 Saurabh 2016-10-06 09:00:25 UTC
Using attached dll in comment#16, I can also reproduce this Issue with stable builds (XS 6.1.1.15 + XI 10.0.1.10). This is the build output for the same: https://gist.github.com/saurabh360/cca37acea52ffcb380319c67d7e7f447

I have checked the same Issue with latest master builds (XS 6.2.0.750, XI 10.1.0.135) and observed that template application having .dll added, build successfully.
Build Output: https://gist.github.com/saurabh360/a1fe2dac34313374c4789f285595290f

Environment Info: https://gist.github.com/saurabh360/8a533503efa324b3ffaaaff96d192c22
Comment 18 jon.hunt 2016-12-12 17:11:33 UTC
Can you explain with some more detail on what this means?

the easiest way would be to do a "binary search" using `--linkskip=XXX` on your binding assemblies.

How do I do a binary search for linkskip=XXX and what are the binding assemblies? Sorry I'm getting the same crash in MonoTouch trying to build my XI app.

Note You need to log in before you can comment on or make changes to this bug.