Bug 58874

Summary: Unexpected error while compiling for Ad-hoc
Product: iOS Reporter: silentiumbravo
Component: GeneralAssignee: Bugzilla <bugzilla>
Status: RESOLVED DUPLICATE    
Severity: normal CC: brendan.zagaeski, mono-bugs+monotouch
Priority: ---    
Version: XI 10.12 (d15-3)   
Target Milestone: Untriaged   
Hardware: PC   
OS: Windows   
Tags: Is this bug a regression?: ---
Last known good build:

Description silentiumbravo 2017-08-18 09:00:35 UTC
Compiling for Ad-hoc with my vs xamarin ios - getting the following error: 


C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(747,3): error : Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
1>  System.NullReferenceException: Object reference not set to an instance of an object
1>    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 
1>    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 
1>    at Xamarin.Bundler.Target.ManagedLink () [0x005c5] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Target.cs:614 
1>    at Xamarin.Bundler.Target.ProcessAssemblies () [0x000bb] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Target.cs:800 
1>    at Xamarin.Bundler.Application.ProcessAssemblies () [0x0002f] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Application.cs:1396 
1>    at Xamarin.Bundler.Application.BuildManaged () [0x00001] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Application.cs:827 
1>    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 
1>    at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0 
1>    at Xamarin.Bundler.Application.BuildAll () [0x00050] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/Application.cs:775 
1>    at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x00481] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/tools/mtouch/mtouch.cs:1420 
1>    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 silentiumbravo 2017-08-18 09:30:52 UTC
Its working fine if I turn to "Do not link", instead of "Link framework sdk only". But it doubles the app size!
And my project was compiling fine a week ago, and i didn't change anything...
I saw the zip file in here ,https://bugzilla.xamarin.com/show_bug.cgi?id=58789#c4
As I understood, that should increase the info about the bug , but again - there was no bug in my app, and its working with debug and release mods - how would advance log change anything....
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2017-08-18 17:46:34 UTC
> how would advance log change anything

Bug 58789, Comment 0 explains that the error message you are seeing in your Comment 0 when building is not the correct complete error message (due to a bug in Xamarin.iOS 10.12).  Specifically, this kind of error when building is _supposed_ to include the name of the assembly where the exception occurs when the managed linker [1] is running during the Xamarin.iOS build process, but in Xamarin.iOS 10.12 it does not.

[1] https://developer.xamarin.com/guides/ios/advanced_topics/linker/


Unfortunately, Xamarin.iOS version 10.12 includes _two_ layers of bugs related to this error message:

- The first bug is Bug 58789.  That bug causes the error message to be _missing_ information.  This is a bug in Xamarin.iOS, not in your app.

- An example of the second bug is described in Bug 58834.  Bug 58834 shows an example of the correct "full" error message from the linker during the build process that shows the name of the problematic assembly.  This is also a bug in Xamarin.iOS and not a bug in your app.




## Some possible options for your next steps

- You could downgrade Xamarin.iOS temporarily [2] until a candidate build is available that contain the fixes for both Bug 58789 and Bug 58834.  (Work is currently underway to prepare an appropriate Xamarin.iOS installer package that includes both fixes.)

- For now you could temporarily proceed with development with the linker disabled until the candidate build are available.  (Device builds can be fairly slow with the linker disabled due to the AOT compilation having more work to do, but simulator builds should be fine.)

- You could install the `mtouch` patch from Bug 58789, Comment 0 and follow the steps mentioned on that bug to gather the diagnostic verbose build output with the patch in place.  That will allow you to see which assembly _in particular_ is causing this linker error.  Once you know which assembly is causing the issue, you can potentially work around the issue temporarily by moving the debugger symbol files (*.pdb and *.dll.mdb) for that problematic NuGet package to a backup location outside of your project directory.

[2] (The last section of https://releases.xamarin.com/stable-release-15-3/ lists the previous Xamarin.iOS version number and where to find it.)

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