Bug 36577 - MTOUCH: error MT6002: Could not strip assembly System.Runtime.dll
Summary: MTOUCH: error MT6002: Could not strip assembly System.Runtime.dll
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General (show other bugs)
Version: unspecified
Hardware: Macintosh Mac OS
: High major
Target Milestone: (C7)
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2015-12-04 07:34 UTC by Ramon
Modified: 2016-06-02 10:33 UTC (History)
5 users (show)

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


Attachments
Full output mtouch failure (524.54 KB, text/rtf)
2015-12-07 07:55 UTC, Ramon
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:
VERIFIED FIXED

Description Ramon 2015-12-04 07:34:14 UTC
# Steps to reproduce
I have a Xamarin.Forms (1.5.1.6471) project in which I need to tell the linker to preserve the System.Runtime.dll --> Additional mtouch arguments: -linkskip=System.Runtime
Since the update to Xamarin 4 I'm not able to compile in Release Mode or Archive for publishing. See image attached for my iOS Build properties.

# Expected behavior
Generate the archive file properly.

# Actual behavior
This is the error I'm getting:
Error: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
        Parameter name: index
          at System.Collections.CollectionBase.System.Collections.IList.get_Item (Int32 index) <0x17acd10 + 0x0008b> in <filename unknown>:0 
          at Mono.Cecil.AssemblyNameReferenceCollection.get_Item (Int32 index) <0x5bafd8 + 0x0001e> in <filename unknown>:0 
          at Mono.Cecil.ReflectionReader.GetExportedTypeScope (MetadataToken scope) <0x5c5268 + 0x0004f> in <filename unknown>:0 
          at Mono.Cecil.ReflectionReader.VisitExternTypeCollection (Mono.Cecil.ExternTypeCollection externs) <0x5c4e78 + 0x001bf> in <filename unknown>:0 
          at Mono.Cecil.AggressiveReflectionReader.ReadExternTypes () <0x5c4d58 + 0x00027> in <filename unknown>:0 
          at Mono.Cecil.AggressiveReflectionReader.VisitTypeDefinitionCollection (Mono.Cecil.TypeDefinitionCollection types) <0x5b9de0 + 0x00083> in <filename unknown>:0 
          at Mono.Cecil.ReflectionReader.VisitModuleDefinition (Mono.Cecil.ModuleDefinition mod) <0x5b9db8 + 0x0001f> in <filename unknown>:0 
          at Mono.Cecil.StructureReader.TerminateAssemblyDefinition (Mono.Cecil.AssemblyDefinition asm) <0x5b9c18 + 0x00081> in <filename unknown>:0 
          at Mono.Cecil.AssemblyDefinition.Accept (IReflectionStructureVisitor visitor) <0x4f4bb0 + 0x00050> in <filename unknown>:0 
          at Mono.Cecil.AssemblyFactory.GetAssembly (Mono.Cecil.Binary.ImageReader irv, Boolean manifestOnly) <0x4f4430 + 0x000a7> in <filename unknown>:0 
          at Mono.Cecil.AssemblyFactory.GetAssembly (Mono.Cecil.Binary.ImageReader reader) <0x4f4400 + 0x0001b> in <filename unknown>:0 
          at Mono.Cecil.AssemblyFactory.GetAssembly (System.String file) <0x4e9a98 + 0x0001b> in <filename unknown>:0 
          at Mono.CilStripper.Program.Main (System.String[] args) <0x4e7ed8 + 0x00063> in <filename unknown>:0 

MTOUCH: error MT6002: Could not strip assembly `/Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/System.Runtime.dll`.
    Task "MTouch" execution -- FAILED
    Done building target "_CompileToNative" in project "/Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/VoluntadLegal.iOS.csproj".-- FAILED

Done building project "/Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/VoluntadLegal.iOS.csproj".-- FAILED

Build FAILED.

# Supplemental info (logs, images, videos)
http://cd8ba0b44a15c10065fd-24461f391e20b7336331d5789078af53.r23.cf1.rackcdn.com/xamarin.vanillaforums.com/FileUpload/22/810d5a84ec7c26cd46118aaeb0071d.png



# Test environment (full version information)
Xamarin Studio
Version 5.10.1 (build 3)
Installation UUID: 837c8580-1d1a-41bd-9860-469492eda585
Runtime:
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010102

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

Apple Developer Tools
Xcode 7.1.1 (9081)
Build 7B1005

Xamarin.iOS
Version: 9.2.1.54 (Indie Edition)
Hash: eb4c1ef
Branch: master
Build date: 2015-12-01 02:12:30-0500

Xamarin.Android
Version: 6.0.0.34 (Indie Edition)
Android SDK: /Users/ramonesteban78/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

Xamarin Android Player
Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

Xamarin.Mac
Not Installed

Build Information
Release ID: 510010003
Git revision: f2021a209d66d49cbc0649a6d968b29040e57807
Build date: 2015-12-01 10:43:40-05
Xamarin addins: dfd4f5103e8951edbc8ac24480b53b53c55e04ff
Build lane: monodevelop-lion-cycle6-baseline

Operating System
Mac OS X 10.10.5
Darwin Ramons-Mac-mini.local 14.5.0 Darwin Kernel Version 14.5.0
    Tue Sep  1 21:23:09 PDT 2015
    root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64
Comment 1 Sebastien Pouliot 2015-12-04 13:09:34 UTC
The tool doing the stripping seems to work fine on the assembly.

$ mono-cil-strip /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/Facades/System.Runtime.dll sr.dll
Mono CIL Stripper

Assembly /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/Facades/System.Runtime.dll stripped out into sr.dll

Can you please attach a full build log, adding `-v -v -v -v` to the Additional mtouch arguments so we can see all the steps that were done during the build ?
Comment 2 Ramon 2015-12-06 09:40:17 UTC
This is the output when I add the additional parameters -v -v -v -v:

		Error: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
		Parameter name: index
		  at System.Collections.CollectionBase.System.Collections.IList.get_Item (Int32 index) <0x17acd10 + 0x0008b> in <filename unknown>:0 
		  at Mono.Cecil.AssemblyNameReferenceCollection.get_Item (Int32 index) <0x5b5fd8 + 0x0001e> in <filename unknown>:0 
		  at Mono.Cecil.ReflectionReader.GetExportedTypeScope (MetadataToken scope) <0x5c0268 + 0x0004f> in <filename unknown>:0 
		  at Mono.Cecil.ReflectionReader.VisitExternTypeCollection (Mono.Cecil.ExternTypeCollection externs) <0x5bfe78 + 0x001bf> in <filename unknown>:0 
		  at Mono.Cecil.AggressiveReflectionReader.ReadExternTypes () <0x5bfd58 + 0x00027> in <filename unknown>:0 
		  at Mono.Cecil.AggressiveReflectionReader.VisitTypeDefinitionCollection (Mono.Cecil.TypeDefinitionCollection types) <0x5b4de0 + 0x00083> in <filename unknown>:0 
		  at Mono.Cecil.ReflectionReader.VisitModuleDefinition (Mono.Cecil.ModuleDefinition mod) <0x5b4db8 + 0x0001f> in <filename unknown>:0 
		  at Mono.Cecil.StructureReader.TerminateAssemblyDefinition (Mono.Cecil.AssemblyDefinition asm) <0x5b4c18 + 0x00081> in <filename unknown>:0 
		  at Mono.Cecil.AssemblyDefinition.Accept (IReflectionStructureVisitor visitor) <0x4efbb0 + 0x00050> in <filename unknown>:0 
		  at Mono.Cecil.AssemblyFactory.GetAssembly (Mono.Cecil.Binary.ImageReader irv, Boolean manifestOnly) <0x4ef430 + 0x000a7> in <filename unknown>:0 
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Refractored.Xam.Settings.Abstractions.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Refractored.Xam.Settings.Abstractions.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/PCLStorage.Abstractions.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/PCLStorage.Abstractions.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Lotz.Xam.Messaging.Abstractions.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Lotz.Xam.Messaging.Abstractions.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/DeviceInfo.Plugin.Abstractions.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/DeviceInfo.Plugin.Abstractions.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Xamarin.Forms.Platform.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Xamarin.Forms.Platform.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Legalitas.Models.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Legalitas.Models.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Refractored.Xam.Settings.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Refractored.Xam.Settings.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Xamarin.Forms.Xaml.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Xamarin.Forms.Xaml.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Lotz.Xam.Messaging.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Lotz.Xam.Messaging.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/PCLStorage.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/PCLStorage.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Connectivity.Plugin.Abstractions.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Connectivity.Plugin.Abstractions.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/System.Xml.Linq.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/System.Xml.Linq.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/VoluntadLegaliOS.exe stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/VoluntadLegaliOS.exe
		
		Copied /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/VoluntadLegaliOS.exe.config to /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/VoluntadLegaliOS.exe.config
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Connectivity.Plugin.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Connectivity.Plugin.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Legalitas.Services.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Legalitas.Services.dll
		
		Copied /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Legalitas.Services.dll.config to /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Legalitas.Services.dll.config
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Microsoft.WindowsAzure.Messaging.iOS.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Microsoft.WindowsAzure.Messaging.iOS.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Microsoft.CSharp.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Microsoft.CSharp.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Media.Plugin.Abstractions.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Media.Plugin.Abstractions.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Flurry.Analytics.Portable.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Flurry.Analytics.Portable.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/System.Net.Http.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/System.Net.Http.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Legalitas.Core.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Legalitas.Core.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Flurry.Analytics.iOS.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Flurry.Analytics.iOS.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Mono.Dynamic.Interpreter.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Mono.Dynamic.Interpreter.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/DeviceInfo.Plugin.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/DeviceInfo.Plugin.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Media.Plugin.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Media.Plugin.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Xamarin.Forms.Platform.iOS.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Xamarin.Forms.Platform.iOS.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/System.Core.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/System.Core.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/System.ServiceModel.Internals.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/System.ServiceModel.Internals.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/VoluntadLegal.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/VoluntadLegal.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/System.Runtime.Serialization.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/System.Runtime.Serialization.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Xamarin.Forms.Core.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Xamarin.Forms.Core.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Newtonsoft.Json.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Newtonsoft.Json.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Xamarin.iOS.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Xamarin.iOS.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/System.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/System.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/System.Xml.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/System.Xml.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/Mono.CSharp.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/Mono.CSharp.dll
		
		Mono CIL Stripper
		
		Assembly /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/mscorlib.dll stripped out into /Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/bin/iPhone/Release/VoluntadLegaliOS.app/.monotouch-64/mscorlib.dll
		
		  at Mono.Cecil.AssemblyFactory.GetAssembly (Mono.Cecil.Binary.ImageReader reader) <0x4ef400 + 0x0001b> in <filename unknown>:0 
		  at Mono.Cecil.AssemblyFactory.GetAssembly (System.String file) <0x4e4a98 + 0x0001b> in <filename unknown>:0 
		  at Mono.CilStripper.Program.Main (System.String[] args) <0x4e2ed8 + 0x00063> in <filename unknown>:0 
		
MTOUCH: error MT6002: Could not strip assembly `/Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/System.Runtime.dll`.
		--- inner exception
MTOUCH: error MT6002: Could not strip assembly `/Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/System.Runtime.dll`.
		---
		  at MonoTouch.Tuner.Stripper.Process (System.String assembly_file, System.String output_file) <0x10ef9a520 + 0x00470> in <filename unknown>:0 
		  at MonoTouch.Target.<StripManagedCode>m__1 (MonoTouch.Assembly assembly) <0x10cadc1e0 + 0x00149> in <filename unknown>:0 
		  at System.Threading.Tasks.Parallel+<ForEachWorker>c__AnonStorey6`2[TSource,TLocal].<>m__0 (Int32 i) <0x10c190df0 + 0x00062> in <filename unknown>:0 
		  at System.Threading.Tasks.Parallel+<ForWorker>c__AnonStorey3`1[TLocal].<>m__1 () <0x10bdf8390 + 0x003d2> in <filename unknown>:0 
	Task "MTouch" execution -- FAILED
	Done building target "_CompileToNative" in project "/Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/VoluntadLegal.iOS.csproj".-- FAILED
	
Done building project "/Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/VoluntadLegal.iOS.csproj".-- FAILED

Build FAILED.

Warnings:

/Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/VoluntadLegal.iOS.csproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets (_CoreCompileImageAssets target) ->

	Resources/Images.xcassets: actool warning : The app icon set "AppIcons" has an unassigned child.

/Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/VoluntadLegal.iOS.csproj (Build) ->
/Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5/Microsoft.CSharp.targets (CoreCompile target) ->

	Renderers/KeyboardOverlapPageRenderer.cs(114,17): warning CS0219: The variable `keyboardFrame' is assigned but its value is never used
	Services/ContactService.cs(38,25): warning CS1998: Async block lacks `await' operator and will run synchronously
	Services/SpeechService.cs(25,24): warning CS0169: The private field `VoluntadLegal.iOS.Services.SpeechService.audioFilePath' is never used

Errors:

/Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/VoluntadLegal.iOS.csproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets (_CompileToNative target) ->

	MTOUCH: error MT6002: Could not strip assembly `/Users/ramonesteban78/Projects/Bravent/201511/Legalitas/VoluntadLegal.iOS/obj/iPhone/Release/mtouch-cache/64/Build/System.Runtime.dll`.

---------------------- Done ----------------------
Comment 3 Sebastien Pouliot 2015-12-06 15:23:35 UTC
I really mean the full log (from start to end after a Clean) and not just the stripping part. 

We need to see every operation that was done (copies and others) on that assemblies to figure out why the original is fine but the copy used in the last step is not. Thanks.
Comment 4 Ramon 2015-12-07 07:55:00 UTC
Created attachment 14141 [details]
Full output mtouch failure
Comment 5 Ramon 2015-12-07 07:55:55 UTC
See last file attached with the full output log.

Regards
Comment 6 Sebastien Pouliot 2015-12-07 13:46:17 UTC
Thanks for the information. I'll try to duplicate the issue based on this.
Comment 7 Bartosz 2015-12-11 16:22:10 UTC
What is the status on this? This is EXTREMELY F***G blocker!!!
Comment 8 Ramon 2015-12-14 07:14:26 UTC
Can I have an update on this issue? My client is still waiting for the new release of the product...
Comment 9 Ramon 2015-12-16 08:27:30 UTC
I just found a similar bug alredy resoloved in the last Alpha Release: https://bugzilla.xamarin.com/show_bug.cgi?id=35786

However after installing the last Alpha Release of Xamarin Studio, I'm still getting the same issue.

Any news?
Comment 10 Sebastien Pouliot 2015-12-17 03:32:54 UTC
@Ramon, no, this is not related to bug #35786, which was an environment issue and not related to the content of the assembly.

OTOH it's related to another, bug #35372, and both fixes must co-exists to solve the issue.


Do you recall why you're excluding System.Runtime.dll from being linked ? I know there was an old bug (#28823) requiring this workaround but that's fixed now. Beside workaround around the issue (until it's fixed/released) it would also be the right thing to do (if applicable in your case).
Comment 11 Ramon 2015-12-17 07:10:39 UTC
Thanks Sebastien for your answer...

Excluding the System.Runtime was the only workaround that I found in order to use my own ViewModels - Views factory using reflexion. This is an example of what I'm doing:


public interface IViewFactory
{
        void Register<TViewModel, TView>() 
            where TViewModel : class, IViewModel 
            where TView : Page;

		Page Resolve<TViewModel>(out TViewModel viewModel, Action<TViewModel> setStateAction = null) 
			where TViewModel : class, IViewModel;


        Page Resolve<TViewModel>(TViewModel viewModel) 
            where TViewModel : class, IViewModel;

		Page Resolve (IViewModel viewModel);
}





public class ViewFactory : IViewFactory
    {
        private readonly IDictionary<Type, Type> _map = new Dictionary<Type, Type>();

		public ViewFactory(){
		}
        
        public void Register<TViewModel, TView>() 
            where TViewModel : class, IViewModel 
            where TView : Page
        {
            _map[typeof(TViewModel)] = typeof(TView);
        }

        public Page Resolve<TViewModel>(TViewModel viewModel) 
            where TViewModel : class, IViewModel 
        {

            var viewType = _map[typeof(TViewModel)];
            var view = Activator.CreateInstance(viewType) as Page;
            view.BindingContext = viewModel;
            viewModel.Navigation = new Navigator(view.Navigation);


            if (string.IsNullOrEmpty(viewModel.Title))
                viewModel.Title = view.Title;
            return view;

        }

		public Page Resolve<TViewModel> (out TViewModel viewModel, Action<TViewModel> setStateAction = null) where TViewModel : class, IViewModel
		{
			viewModel = Activator.CreateInstance (typeof(TViewModel)) as TViewModel;

			var viewType = _map[typeof(TViewModel)];
			var view = Activator.CreateInstance(viewType) as Page;

			if (setStateAction != null)
				viewModel.SetState(setStateAction);

			view.BindingContext = viewModel;
		    (viewModel as ViewModelBase).ToolBarItems = view.ToolbarItems;
			viewModel.Navigation = new Navigator(view.Navigation);

            if (string.IsNullOrEmpty(viewModel.Title))
                viewModel.Title = view.Title;


            return view;
		}

		public Page Resolve (IViewModel viewModel)
		{
			var viewType = _map[viewModel.GetType()];
			var view = Activator.CreateInstance(viewType) as Page;
			view.BindingContext = viewModel;
			viewModel.Navigation = new Navigator(view.Navigation);


            if (string.IsNullOrEmpty(viewModel.Title))
                viewModel.Title = view.Title;		  
			return view;

		}
    }

I have also a Navigation interface implementation, I can attach it if needed.

I don't know if excluding System.Runtime was the best solution but it worked for me. Am I doing something wrong?


Regards
Comment 12 Sebastien Pouliot 2015-12-18 15:52:34 UTC
It's not wrong. When you're using reflection then you have to manually preserve the members that are required (but not referenced). However that's generally preserving things in your own code, not the SDK code (unless the type you're reflecting are in the SDK).

From you code above that does not seems to be the case so it's not clear why preserving System.Runtime.dll would be needed. It's also a PCL facade so skipping it only means it's preserving the forwarded members. If you can file a different bug (it's not really related to this one) along with a self-contained test case then I'd be happy to have a look at it (as it might be something we can avoid, and that be simpler to use). Thanks.
Comment 13 Sebastien Pouliot 2015-12-20 17:06:09 UTC
Fixed in maccore/master 1c050ef00bc6e54b9b2111a478b5c36682d0ec88

@Ramon if you can provide me with more details (e.g. a test case) I'm pretty sure I can come up with a workaround (until the fix is released).
Comment 14 Joe Sauve 2015-12-29 20:16:10 UTC
I'm also seeing this stripping failure when I'm attempting to do some automated builds on Bitrise.io:

Errors:
/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/XamarinCRM.iOS.csproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets (_CompileToNative target) ->
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/System.Linq.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/Syncfusion.SfChart.iOS.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/ExternalMaps.Plugin.Abstractions.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/System.Resources.ResourceManager.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/System.Collections.Concurrent.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/XamarinCRM.Models.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/System.Reflection.Extensions.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/Microsoft.WindowsAzure.Mobile.SQLiteStore.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/ExternalMaps.Plugin.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/Connectivity.Plugin.Abstractions.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/System.Xml.XDocument.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/Connectivity.Plugin.dll`.
	MTOUCH: error MT6002: Could not strip assembly `/Users/vagrant/git/src/MobileApp/XamarinCRM.iOS/obj/iPhone/InHouse/mtouch-cache/32/Build/Xamarin.Forms.Xaml.dll`.
	 5 Warning(s)
	 13 Error(s)
Comment 15 Ramon 2016-01-29 07:03:22 UTC
I'm going to reopen this issue as is not been resolved in Alpha Channel.
I will prepare asap a testing scenario for you to check it.

Regards
Comment 16 Rolf Bjarne Kvinge [MSFT] 2016-01-29 11:02:40 UTC
The fix for this issue is not included in the release currently in the Alpha Channel.

The fix will be included in the next major release (which will likely be Xamarin.iOS 9.6, unless iOS 9.3 comes out first, in which case it'll be Xamarin.iOS 9.8).
Comment 17 Ramon 2016-01-29 18:55:48 UTC
I have finally found a workaround.

I have created a XML file named linker.xml containing the following:


<?xml version="1.0" encoding="UTF-8" ?>
<linker>
    <assembly fullname="System.Runtime">
	    <type fullname="*"/>
	</assembly>
</linker>



Then in the mtouch arguments just indicate the XML file to load with: 

--xml=linker.xml



I hope this helps.

Regards
Comment 18 Bartosz 2016-02-04 14:28:54 UTC
Rolf Bjarne Kvinge:

This is absurd that fix this important is skipped! We are blocked with a new release for over 1.5 months now!

Ramon:
Thanks for the fix!