Bug 35786 - Build "Could not strip assembly"
Summary: Build "Could not strip assembly"
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 9.2
Hardware: Macintosh Mac OS
: --- blocker
Target Milestone: C6SR1
Assignee: Bugzilla
Depends on:
Reported: 2015-11-11 11:23 UTC by Tomasz Cielecki
Modified: 2016-01-05 09:57 UTC (History)
11 users (show)

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

Build log (202.46 KB, text/plain)
2015-11-12 03:43 UTC, Tomasz Cielecki

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:

Description Tomasz Cielecki 2015-11-11 11:23:07 UTC
# Steps to reproduce
Switch to Ad-Hoc or AppStore build configuration
Build app

# Expected behavior
Build should finish without errors

# Actual behavior
Throws errors for a lot of assemblies, such as System.Reflection.Extensions, System.Globalization, System.Linq, System.IO, System.Reactive.Interfaces, System.Diagnostic.Tools, MvvmCross.Plugins.Color.Touch and many more

An example:
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/System.Reflection.Extensions.dll`.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/System.Globalization.dll`.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/MvvmCross.Plugins.Color.Touch.dll`.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/System.Linq.dll`.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/System.IO.dll`.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/System.Dynamic.Runtime.dll`.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/Cheesebaron.MvxPlugins.AppId.Touch.dll`.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/System.Reactive.Interfaces.dll`.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/System.Diagnostics.Tools.dll`.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/System.Collections.Concurrent.dll`.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/System.Threading.dll`.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(660,3): error : Could not strip assembly `/Users/tomasz/Library/Caches/Xamarin/mtbs/builds/NoiseSentinelAppiOS/3209118fc514afc817575a7807a96217/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/MvvmCross.Plugins.Color.dll`.

# Supplemental info (logs, images, videos)

# Test environment (full version information)
Mac Build host:
=== Xamarin Studio ===

Version 5.10 (build 860)
Installation UUID: f7448b1c-a576-4e9a-8ecf-326f70c23e82
	Mono 4.2.1 (explicit/8862921)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010091

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.1 (9079)
Build 7B91b

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 9ce9e8b
Branch: master
Build date: 2015-10-28 19:11:03-0400

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/tomasz/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)

SDK Tools Version: 24.3.3
SDK Platform Tools Version: 22.0.0
SDK Build Tools Version: 22.0.1

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Xamarin.Mac ===

Version: (Starter Edition)

=== Build Information ===

Release ID: 510000860
Git revision: 7c46a0b709d51ad5d5a5ed90a4671cc7b6928e62
Build date: 2015-10-29 17:17:52-04
Xamarin addins: b9337905aca5dc276190d78819728a59cda33a43
Build lane: monodevelop-lion-cycle6

=== Operating System ===

Mac OS X 10.10.5
Darwin tomaszs-mini.bkogc.com 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

------------ Windows 10, VS2015: -------------
Microsoft Visual Studio Enterprise 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00079

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA027
Microsoft Architecture and Modeling Tools
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Visual Basic 2015   00322-80000-00000-AA027
Microsoft Visual Basic 2015

Visual C# 2015   00322-80000-00000-AA027
Microsoft Visual C# 2015

Visual C++ 2015   00322-80000-00000-AA027
Microsoft Visual C++ 2015

Visual F# 2015 RC   00322-80000-00000-AA027
Microsoft Visual F# 2015 RC

Windows Phone SDK 8.0 - ENU   00322-80000-00000-AA027
Windows Phone SDK 8.0 - ENU

.NET Reflector Visual Studio Extension
Integrates .NET Reflector into Visual Studio to allow you to seamlessly debug into third-party code and assemblies, even if you don't have the source code for them.

Visit www.reflector.net for more information.

Copyright (c) 2009-2012 Red Gate Software Inc.

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   14.0.20711.0
ASP.NET and Web Tools

ASP.NET Web Frameworks and Tools 2013   5.2.30624.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.5
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

EmojiVS   1.0
GitHub Emojis in Visual Studio

Extensibility Tools   1.5.103
An extension for making it easier to write Visual Studio extensions

GenerateUnitTest   1.0
Generates unit test code for methods in classes under test.

GitHub.VisualStudio   1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

Indent Guides   14
Indent Guides

Adds visual guides at each indentation level.

JetBrains ReSharper Ultimate 2015.1.3   Build 102.0.20150724.141603
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2015 JetBrains, Inc.

Microsoft Azure HDInsight HQL Service   2.0.2200.0
Language service for Hive query

Microsoft Azure HDInsight Tools for Visual Studio   2.0.2200.0
An integrated development environment for HDInsight application development.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools   2.5
Microsoft Azure Tools for Microsoft Visual Studio 2015 Preview - v2.5.30319.1603

Microsoft Azure Tools   2.7
Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.7.30728.1602

Microsoft Code Digger   0.9
Microsoft Code Digger

Microsoft Team Foundation Server 2015 Power Tools   14.0
Power Tools that extend the Team Foundation Server integration with Visual Studio.

Microsoft Visual Studio Process Editor   1.0
Process Editor for Microsoft Visual Studio Team Foundation Server

Microsoft.Pex.VisualStudio   1.0

NuGet Package Manager   3.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Python Tools for Visual Studio   2.2.30718.00
Python Tools for Visual Studio provides IntelliSense, projects, templates, Interactive windows, and other support for Python developers.

Python Tools for Visual Studio - Django Integration   2.2.30718.00
Provides templates and integration for the Django web framework.

Python Tools for Visual Studio - Profiling Support   2.2.30718.00
Profiling support for Python projects.

Roslyn Syntax Visualizer   1.0
An extension for visualizing Roslyn SyntaxTrees.

SQL Server Data Tools   14.0.50616.0
Microsoft SQL Server Data Tools

Visual Studio Tools for Universal Windows Apps   14.0.23309.00 d14oob
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin (90e1af2)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (9d7074e)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS (9ce9e8b)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 GouriKumari 2015-11-11 14:01:04 UTC
Can you attach a sample or testcase to reproduce this issue?
Comment 2 Sebastien Pouliot 2015-11-11 15:27:32 UTC
@Tomasz does this happens when the build id sone from the Mac side ?

Complete build logs (with `-v -v -v -v` added to the "Additional mtouch arguments") could also prove useful. Thanks
Comment 4 Tomasz Cielecki 2015-11-12 03:43:23 UTC
Created attachment 13784 [details]
Build log
Comment 5 Tomasz Cielecki 2015-11-12 03:45:23 UTC
I have attached a build log, working on a reproducible sample.
Comment 6 Tomasz Cielecki 2015-11-12 04:34:15 UTC
It builds on the mac, but not when I do it from VS. So there is a problem somewhere in that flow.
Comment 7 Rolf Bjarne Kvinge [MSFT] 2015-11-12 04:50:09 UTC
This is related to bug #25008, where the problem was too many file descriptors.

In fact I can reproduce the error with an app that references 300 assemblies (a quick count shows you have 97 assemblies, so maybe you have a lower file descriptor limit for some reason).

@Tomasz: are you able to build the project from Xamarin Studio on the Mac? My guess is that it'll work, since Xamarin Studio automatically increases the number of file descriptors (but you would hit the same problem if you built the project from a terminal on the Mac with xbuild).
Comment 8 Rolf Bjarne Kvinge [MSFT] 2015-11-12 04:51:12 UTC
Ah, you just answered my question.

@Tomasz: is building release builds on the Mac a temporary solution that would work for you right now?
Comment 9 Tomasz Cielecki 2015-11-12 05:06:04 UTC
@Rolf: Building release builds from XS on the Mac is OK for now. It would be awesome if I could do it from VS as well.
Comment 10 Rolf Bjarne Kvinge [MSFT] 2015-11-12 06:24:14 UTC

maccore/master: 801ad424503b7aa181d2c9fb6982d20769a9d4d9
Comment 13 asimk 2015-11-25 08:21:58 UTC
I have tried to reproduce this issue with the builds which is provided in bug description but unable to reproduce this issue. 
I am able to build application with Ad-Hoc or AppStore build configuration. Also I am able to build application using multiple assemblies references.
Could you please have a look on the following screencast and let us know what additional steps we need to follow to reproduce this issue.
Here is the screencast for the same: http://www.screencast.com/t/4uanug6nPG

Environment Info:
Comment 14 Tomasz Cielecki 2015-11-25 08:23:53 UTC
You need to add a lot more references
Comment 15 Rolf Bjarne Kvinge [MSFT] 2015-11-25 10:20:45 UTC
@asimk, try this test project: https://files.xamarin.com/~rolf/bug35786.zip

You need to build using xbuild in the project directory:

    xbuild /p:Platform=iPhone /p:Configuration=Release
Comment 16 asimk 2015-11-25 12:43:46 UTC
Thanks Rolf,
I am able to reproduce this issue using test project provided in comment 15, here is the screencast for the same: http://www.screencast.com/t/zQyhrKkdK6

And it is working fine with fixed master build i.e.
Here is the screencast for the same: http://www.screencast.com/t/QhhWnne1igeO

So I am closing this issue.
Comment 17 Ryan Niebur 2015-11-25 20:26:14 UTC
I ran into this issue upgrading build servers to Xamarin 4 and worked around it by using the Alpha.
Comment 18 Ryan Niebur 2015-11-25 21:44:32 UTC
Ignore my comment about Alpha, I do not think it included this. I was able to build once on it, but subsequent builds continued to fail as before. My current workaround is to "Enable Debugging".
Comment 19 Simon Taylor 2015-12-01 04:20:01 UTC
It's been almost three weeks since this was raised. Any plans to release a fix? Not being able to produce a release build is a bit of a showstopper.
Comment 20 Rolf Bjarne Kvinge [MSFT] 2015-12-01 08:52:02 UTC
@Simon, if using Xamarin Studio to build a release build isn't a viable solution for you, it's also possible to work around this by increasing the maximum number of open file descriptors on your Mac. This should explain how: http://superuser.com/a/303058/61379 (you do not have to set the limit as high as that post suggests, the default limit is 256, so setting it to 1024 should be more than enough). You can test any changes by rebooting and executing "ulimit -n" from a terminal window (it should show the number you set).
Comment 21 Simon Taylor 2015-12-01 12:54:33 UTC
Thanks, I've already downgraded.
Comment 22 Ace Olszowka 2015-12-10 23:38:45 UTC
Ran into the same issue, however the solution linked by @Rolf Bjarne Kvinge does not contain a fix for 10.11 (El Capitan) that persists.

This Unix StackExchange had a solution that worked for us for persisting the change: http://unix.stackexchange.com/questions/108174/how-to-persist-ulimit-settings-in-osx-mavericks
Comment 23 Paul Roy 2016-01-05 09:57:17 UTC
Had the same problem (only for AppStore builds), the fix with limit worked.

How is it that we never had this issue with the previous build host? 256 files opened at the same time seems huge.