Bug 58820 - Null reference exception building for iOS physical device
Summary: Null reference exception building for iOS physical device
Status: RESOLVED DUPLICATE of bug 58789
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: XI 10.12 (d15-3)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-08-16 17:14 UTC by John Hardman
Modified: 2017-08-17 16:24 UTC (History)
7 users (show)

Tags: iOS build NRE nullreferenceexception
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:
Status:
RESOLVED DUPLICATE of bug 58789

Description John Hardman 2017-08-16 17:14:37 UTC
Attempting to build and deploy to iOS physical device from Visual Studio 2017 is producing the following error,


6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(748,3): error : Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
6>  System.NullReferenceException: Object reference not set to an instance of an object
6>    at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x00145] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Tuning.cs:94 
6>    at Xamarin.Bundler.Target.LinkAssemblies (System.Collections.Generic.List`1[Mono.Cecil.AssemblyDefinition]& assemblies, System.String output_dir, System.Collections.Generic.IEnumerable`1[T] sharedCodeTargets) [0x0029a] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Target.cs:491 
6>    at Xamarin.Bundler.Target.ManagedLink () [0x005c5] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Target.cs:614 
6>    at Xamarin.Bundler.Target.ProcessAssemblies () [0x000bb] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Target.cs:800 
6>    at Xamarin.Bundler.Application.ProcessAssemblies () [0x0002f] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Application.cs:1396 
6>    at Xamarin.Bundler.Application.BuildManaged () [0x00001] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Application.cs:827 
6>    at Xamarin.Bundler.Application+<>c.<BuildAll>b__134_1 (Xamarin.Bundler.Application v) [0x00000] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Application.cs:775 
6>    at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0 
6>    at Xamarin.Bundler.Application.BuildAll () [0x00050] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Application.cs:775 
6>    at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x00481] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/mtouch.cs:1420 
6>    at Xamarin.Bundler.Driver.Main (System.String[] args) [0x0000f] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/mtouch.cs:945
Comment 1 John Hardman 2017-08-16 17:15:46 UTC
I should have mentioned - that's using VS2017 v15.3 community edition
Comment 2 Elias Rincon 2017-08-16 17:41:18 UTC
Provably this is a duplicated of this

https://bugzilla.xamarin.com/show_bug.cgi?id=58762
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2017-08-17 00:21:58 UTC
Thanks for the report.  There is a workaround download available in Bug 58789, Comment 4 that will give the intended error.

After you complete the steps in that comment to install the workaround `mtouch` version on your connected Mac, you should get a more useful linker error message that will better indicate how to resolve the issue.  As mentioned on Bug 58789, if you suspect that the more precise linker error indicates an issue that will need to be resolved in the Xamarin.iOS source code (rather than by adjusting your project), please do reopen this bug with your new build logs (that include the new linker error message).

Or, if by chance you are using the Xamarin.Auth library, and you find that the new error message is about Xamarin.Auth and matches Bug 58813, you can optionally directly mark this bug as a duplicate of that bug to help tally affected users on that issue (or you can just reply back on this bug with the updated error message about Xamarin.Auth, and I'll take care of the duplication bookkeeping).  Thanks in advance!

*** This bug has been marked as a duplicate of bug 58789 ***
Comment 4 John Hardman 2017-08-17 16:24:18 UTC
Thanks Brendan. As a result of your very helpful and detailed response, I applied the patch from comment 4 of https://bugzilla.xamarin.com/show_bug.cgi?id=58789, downgraded the Xamarin.Auth version used in my iOS build to 1.3.2.7 (thankfully, I had already arranged my Xamarin.Auth related code such that I can use different versions for different platforms), and turned off linking. That combination got things working again.

For completeness, I'll copy this to bugs 58789 and 58813 as well.