Bug 58796

Summary: mtouch linker crash - nullreferenceexception
Product: iOS Reporter: mikebroughton
Component: GeneralAssignee: Bugzilla <bugzilla>
Status: RESOLVED DUPLICATE    
Severity: normal CC: alex.soto, brendan.zagaeski, mikebroughton, mono-bugs+monotouch
Priority: ---    
Version: XI 10.12 (d15-3)   
Target Milestone: Untriaged   
Hardware: PC   
OS: Windows   
Tags: Xamarin.Auth Is this bug a regression?: ---
Last known good build:
Attachments: Build Log

Description mikebroughton 2017-08-15 23:23:10 UTC
Setting Linker Behavior to "Link Framework SDKs Only" generates a nullreferenceexception on build.

Visual Studio 2017 (15.3)

System.NullReferenceException: Object reference not set to an instance of an object
5>    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 
5>    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 
5>    at Xamarin.Bundler.Target.ManagedLink () [0x005c5] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Target.cs:614 
5>    at Xamarin.Bundler.Target.ProcessAssemblies () [0x000bb] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Target.cs:800 
5>    at Xamarin.Bundler.Application.ProcessAssemblies () [0x0002f] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Application.cs:1396 
5>    at Xamarin.Bundler.Application.BuildManaged () [0x00001] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Application.cs:827 
5>    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 
5>    at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0 
5>    at Xamarin.Bundler.Application.BuildAll () [0x00050] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Application.cs:775 
5>    at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x00481] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/mtouch.cs:1420 
5>    at Xamarin.Bundler.Driver.Main (System.String[] args) [0x0000f] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/mtouch.cs:945 
5>  Tool /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch execution finished.
5>  MTouch: 2017-08-15T16:04:35.0612685-07:00 - Finished
5>Done executing task "MTouch" -- FAILED.
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2017-08-15 23:47:35 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 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).  Thanks in advance!

*** This bug has been marked as a duplicate of bug 58789 ***
Comment 2 mikebroughton 2017-08-16 20:45:19 UTC
Created attachment 24251 [details]
Build Log


I am now having the same issue as described in bug 58813.

The linker error message now states that the issue lies with Xamarin.Auth.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(748,3): error : Error processing the method 'System.Void Xamarin.Auth.Account::.ctor(System.String,System.Collections.Generic.IDictionary`2<System.String,System.String>)' in the assembly 'Xamarin.Auth.dll': Value cannot be null.
5>  Parameter name: instruction
5>  --- inner exception
5>  Mono.Linker.MarkException: Error processing method: 'System.Void Xamarin.Auth.Account::.ctor(System.String,System.Collections.Generic.IDictionary`2<System.String,System.String>)' in assembly: 'Xamarin.Auth.dll' ---> System.ArgumentNullException: Value cannot be null.
5>  Parameter name: instruction

Building with no linking succeeds.
Comment 3 Alex Soto [MSFT] 2017-08-16 22:06:55 UTC
Please see Comment # 1 here https://bugzilla.xamarin.com/show_bug.cgi?id=58813#c1 and provide the same information.

*** This bug has been marked as a duplicate of bug 58813 ***