Bug 56253 - [linker][cecil] ArgumentNullException
Summary: [linker][cecil] ArgumentNullException
Status: RESOLVED DUPLICATE of bug 56296
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools (show other bugs)
Version: XI 10.10 (d15-2)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 15.3
Assignee: Bugzilla
URL:
Depends on: 53805
Blocks:
  Show dependency tree
 
Reported: 2017-05-11 21:55 UTC by Fred
Modified: 2017-05-12 21:54 UTC (History)
5 users (show)

Tags: 15.2R
Is this bug a regression?: Yes
Last known good build: Latest Beta of Visual Studio for Mac


Attachments
pcl binary (349.50 KB, application/x-msdownload)
2017-05-12 06:07 UTC, Fred
Details
pcl debug file (59.29 KB, application/octet-stream)
2017-05-12 06:07 UTC, Fred
Details
Full build log (2.34 MB, text/plain)
2017-05-12 21:51 UTC, Fred
Details


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 56296

Description Fred 2017-05-11 21:55:32 UTC
Once having updated to the GA version of Visual Studio for Mac, I cannot build my app for the device anymore.
The link step is failing (see log excerpt below).
Build for simulator works fine.
And setting the linker option to "Don't link" it builds and links successfully but then produces a 160Mb binary... which I can't release.

Tried to see if I could downgrade to a previous beta release, but haven't found the way. Not sure it is possible.

I'm stuck :/

Build log:

...
PreBuild using mode 'SDKOnly'
    MTOUCH : error MT2001: Could not link assemblies.
        Method: `System.Collections.Generic.List`1<System.String> fipacapp.Model.FipacSearchCriterias::get_l_nb_pieces()`
        Assembly: `fipacapp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null`
    Reason: Value cannot be null.
    Parameter name: instruction
    --- inner exception
    System.ArgumentNullException: Value cannot be null.
    Parameter name: instruction
      at Mono.Cecil.Cil.InstructionOffset..ctor (Mono.Cecil.Cil.Instruction instruction) [0x00003] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody (Mono.Cecil.Cil.AsyncMethodBodyDebugInformation async_method) [0x0005c] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations (Mono.Cecil.MethodDefinition method) [0x00032] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.Cil.CodeReader.ReadDebugInfo () [0x0004d] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.Cil.CodeReader.ReadMethodBody () [0x00091] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.Cil.CodeReader.ReadMethodBody (Mono.Cecil.MethodDefinition method) [0x00014] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.MetadataReader.ReadMethodBody (Mono.Cecil.MethodDefinition method) [0x00000] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.MethodDefinition+<>c.<get_Body>b__41_0 (Mono.Cecil.MethodDefinition method, Mono.Cecil.MetadataReader reader) [0x00000] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.ModuleDefinition.Read[TItem,TRet] (TRet& variable, TItem item, System.Func`3[T1,T2,TResult] read) [0x00040] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.MethodDefinition.get_Body () [0x0002c] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00191] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:1046 
      at Xamarin.Linker.Steps.CoreMarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00060] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/linker/CoreMarkStep.cs:171 
      at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00026] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:150 
      at Mono.Linker.Steps.MarkStep.Process () [0x0001e] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:115 
      at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x0000f] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/external/linker/linker/Mono.Linker.Steps/MarkStep.cs:60 
      at Xamarin.Linker.Steps.MobileMarkStep.Process (Mono.Linker.LinkContext context) [0x00003] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/linker/MobileMarkStep.cs:33 
      at Xamarin.Linker.Steps.CoreMarkStep.Process (Mono.Linker.LinkContext context) [0x00018] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/linker/CoreMarkStep.cs:26 
      at MonoTouch.Tuner.MonoTouchMarkStep.Process (Mono.Linker.LinkContext context) [0x0001e] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/linker/MonoTouch.Tuner/MonoTouchMarkStep.cs:36 
      at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00027] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/external/linker/linker/Mono.Linker/Pipeline.cs:118 
      at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x000dd] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Tuning.cs:82 
    ---
      at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x002a9] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Tuning.cs:111 
      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) [0x00257] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Target.cs:551 
      at Xamarin.Bundler.Target.ManagedLink () [0x005ce] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Target.cs:674 
      at Xamarin.Bundler.Target.ProcessAssemblies () [0x000b4] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Target.cs:854 
      at Xamarin.Bundler.Application.ProcessAssemblies () [0x00036] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Application.cs:1355 
      at Xamarin.Bundler.Application.BuildManaged () [0x00002] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Application.cs:809 
      at Xamarin.Bundler.Application.<BuildAll>m__7 (Xamarin.Bundler.Application v) [0x00001] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Application.cs:761 
      at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/collections/generic/list.cs:564 
      at Xamarin.Bundler.Application.BuildAll () [0x00067] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Application.cs:761 
      at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x0048b] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/mtouch.cs:1495 
      at Xamarin.Bundler.Driver.Main (System.String[] args) [0x0000f] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/mtouch.cs:1006 
    The command exited with code 1.
    Output Property: _CompiledArchitectures=ARMv7, ARM64
  Done executing task "MTouch" -- FAILED.
Done building target "_CompileToNative" in project "fipacapp.iOS.csproj" -- FAILED.

------------------------------------------------------------

With the linker option "Link All" the beginning of the trace is a bit different :

PreBuild using mode 'All'
    MTOUCH : error MT2091: Inliner failed processing `System.Collections.Generic.List`1<System.String> fipacapp.Model.FipacSearchCriterias::get_l_nb_pieces()`.
    --- inner exception
    System.ArgumentNullException: Value cannot be null.
    Parameter name: instruction
      at Mono.Cecil.Cil.InstructionOffset..ctor (Mono.Cecil.Cil.Instruction instruction) [0x00003] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody (Mono.Cecil.Cil.AsyncMethodBodyDebugInformation async_method) [0x0005c] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations (Mono.Cecil.MethodDefinition method) [0x00032] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.Cil.CodeReader.ReadDebugInfo () [0x0004d] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.Cil.CodeReader.ReadMethodBody () [0x00091] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.Cil.CodeReader.ReadMethodBody (Mono.Cecil.MethodDefinition method) [0x00014] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.MetadataReader.ReadMethodBody (Mono.Cecil.MethodDefinition method) [0x00000] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.MethodDefinition+<>c.<get_Body>b__41_0 (Mono.Cecil.MethodDefinition method, Mono.Cecil.MetadataReader reader) [0x00000] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.ModuleDefinition.Read[TItem,TRet] (TRet& variable, TItem item, System.Func`3[T1,T2,TResult] read) [0x00040] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Mono.Cecil.MethodDefinition.get_Body () [0x0002c] in <f600880ba02c4bfa9f6f865ec45cc869>:0 
      at Xamarin.Linker.Steps.InlinerSubStep.Process (Mono.Cecil.MethodDefinition method) [0x00013] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/linker/MonoTouch.Tuner/InlinerSubStep.cs:39 
      at Xamarin.Linker.ExceptionalSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00004] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/linker/ExceptionalSubStep.cs:50 
    ---
      at Xamarin.Linker.ExceptionalSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00014] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/linker/ExceptionalSubStep.cs:52 
      at Mono.Tuner.SubStepDispatcher.DispatchMethod (Mono.Cecil.MethodDefinition method) [0x0001d] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/external/linker/tuner/Mono.Tuner/Dispatcher.cs:215 
      at Mono.Tuner.SubStepDispatcher.BrowseMethods (System.Collections.ICollection methods) [0x0001c] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/external/linker/tuner/Mono.Tuner/Dispatcher.cs:167 
      at Mono.Tuner.SubStepDispatcher.BrowseTypes (System.Collections.ICollection types) [0x0006b] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/external/linker/tuner/Mono.Tuner/Dispatcher.cs:145 
      at Mono.Tuner.SubStepDispatcher.BrowseAssemblies (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x00050] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/external/linker/tuner/Mono.Tuner/Dispatcher.cs:123 
      at Mono.Tuner.SubStepDispatcher.Process (Mono.Linker.LinkContext context) [0x0000f] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/external/linker/tuner/Mono.Tuner/Dispatcher.cs:104 
      at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00027] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/external/linker/linker/Mono.Linker/Pipeline.cs:118 
      at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x0010b] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Tuning.cs:89 
      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) [0x00257] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Target.cs:551 
      at Xamarin.Bundler.Target.ManagedLink () [0x005ce] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Target.cs:674 
      at Xamarin.Bundler.Target.ProcessAssemblies () [0x000b4] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Target.cs:854 
      at Xamarin.Bundler.Application.ProcessAssemblies () [0x00036] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Application.cs:1355 
      at Xamarin.Bundler.Application.BuildManaged () [0x00002] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Application.cs:809 
      at Xamarin.Bundler.Application.<BuildAll>m__7 (Xamarin.Bundler.Application v) [0x00001] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Application.cs:761 
      at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/collections/generic/list.cs:564 
      at Xamarin.Bundler.Application.BuildAll () [0x00067] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/Application.cs:761 
      at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x0048b] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/mtouch.cs:1495 
      at Xamarin.Bundler.Driver.Main (System.String[] args) [0x0000f] in /Users/builder/data/lanes/4691/3e5ac5ff/source/xamarin-macios/tools/mtouch/mtouch.cs:1006 
    The command exited with code 1.
    Output Property: _CompiledArchitectures=ARMv7, ARM64
  Done executing task "MTouch" -- FAILED.
Done building target "_CompileToNative" in project "fipacapp.iOS.csproj" -- FAILED.


Visual Studio Community 2017 for Mac
Version 7.0 (build 3146)
Installation UUID: 4188b7f7-3304-4379-a8bd-58b23a56df71
Runtime:
	Mono 5.0.0.100 (2017-02/9667aa6) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 500000100

NuGet
Version: 4.0.0.2323

.NET Core
Runtime: /usr/local/share/dotnet/dotnet
SDK: /usr/local/share/dotnet/sdk/1.0.1/Sdks
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.0.0/lib/mono/msbuild/15.0/bin/Sdks

Xamarin.Profiler
Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Apple Developer Tools
Xcode 8.3.2 (12175)
Build 8E2002

Xamarin.iOS
Version: 10.10.0.33 (Visual Studio Community)
Hash: 3e5ac5ff
Branch: d15-2
Build date: 2017-05-05 18:11:38-0400

Xamarin.Android
Version: 7.3.0.13 (Visual Studio Community)
Android SDK: /Users/fmeyer/Library/Android/sdk
	Supported Android versions:
		7.0 (API level 24)
		7.1 (API level 25)

SDK Tools Version: 26.0.2
SDK Platform Tools Version: 25.0.5
Comment 1 Sebastien Pouliot 2017-05-11 22:20:24 UTC
The stack trace shows this happens when reading the portable pdb (debug symbols) generated by Roslyn.

In case you want to downgrade it's more likely a change in Mono (since your last upgrade) but less likely from XI itself (since we don't ship the compiler).

However the fix (correct support) for portable pdb will be ship from XI so could you attach both `fipacapp.dll` and `fipacapp.pdb` files ?

Thanks!

note: you can mark the attachment private
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-11 23:47:24 UTC
> note: you can mark the attachment private

Note that community members cannot mark items as private in Bugzilla 5.0 except by filing a new bug report where the whole bug report is set to the "Xamarin Team" group.  I have marked this whole bug report as private in case the reporter would like to attach items non-publicly.  Once the desired items are attached, a member of the Xamarin team can optionally mark the individual attachments as non-public and reset the overall bug report to public (if desired).
Comment 5 Fred 2017-05-12 08:05:53 UTC
Ok so here is the summary of my experiments:

- I must have been wrong because every 5.x versions of Mono (I just tested all of them) are failing to build the device binary
- I had to resort using the latest stable 4.8.1 version to be able to produce a binary *and* using Xamarin Studio because Visual Studio for Mac wouldn't launch complaining that it requires a 5.x mono version...

Thanks Sebastien for giving me a workaround.

And to add to that, even if out of scope of this report, publishing to the App Store was failing too. Got stuck at the "Authenticating with Itunes Store" step.
Had to:

- cd $HOME
- mv .itmstransporter/ .old_itmstransporter/
- "/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/itms/bin/iTMSTransporter"

to let iTMSTransporter update itself...

And then, at last, I have a new binary in Apple's TestFlight now.

Aouch!
Coders' life are not easy... nor fun sometimes.
Comment 6 Sebastien Pouliot 2017-05-12 16:09:30 UTC
I'm glad the workaround unblocked you :) and thanks for supplying the files. We'll look at them shortly and update the bug report with our findings.
Comment 7 Sebastien Pouliot 2017-05-12 20:06:46 UTC
I'm fairly certain that it's a dupe of #56296

@Fred one last request, can you add "-v -v -v -v" to your Additional mtouch arguments (project options) and attach the full build log.

You do not have to upgrade to get the error back :) I mainly want to confirm if `xamlc` is called on `fipacapp.dll`. Thanks!
Comment 8 Fred 2017-05-12 21:51:12 UTC
Created attachment 22149 [details]
Full build log

Full build log as requested
Did a full rebuild but still with XS 6.3 / Mono 4.8.1 (hence without the linker issue)
Comment 9 Sebastien Pouliot 2017-05-12 21:54:22 UTC
>	Task "XamlCTask"
>		Using task XamlCTask from Xamarin.Forms.Build.Tasks.XamlCTask, Xamarin.Forms.Build.Tasks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
>		Compiling Xaml
>		
> Assembly: obj/Release/fipacapp.dll

This confirms the issue is a duplicate. Thanks!

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