Bug 44732 - iOS build fails on cp -f command to copy assembly to Mac.
Summary: iOS build fails on cp -f command to copy assembly to Mac.
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.2.0 (C8)
Hardware: PC Windows
: High major
Target Milestone: 4.3.0 (C9)
Assignee: Gonzalo Martin
URL:
Depends on:
Blocks:
 
Reported: 2016-09-26 11:02 UTC by Svante
Modified: 2017-01-05 18:47 UTC (History)
8 users (show)

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


Attachments
Zipped logs (12.90 KB, application/x-zip-compressed)
2016-10-22 14:26 UTC, Svante
Details
Zip logs for fixed bug (4.14 KB, application/x-zip-compressed)
2017-01-05 18:46 UTC, Gonzalo Martin
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 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 Svante 2016-09-26 11:02:45 UTC
Building Xamarin.Forms app for iOS takes a very long time, and then the following messages are displayed in the Build output window. It seems like some form of timeout.

C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning : Failed to execute 'cp -f /Users/svante/Library/Caches/Xamarin/mtbs/builds/AxCrypt.XamForms.iOS/f916c117f956aa8f34dfe22acfaab614/C:/Users/Svante/Documents/Visual Studio 2015/Projects/axcrypt-net/BouncyCastle.AxCrypt/bin/Debug/BouncyCastle.AxCrypt.dll /Users/svante/Library/Caches/Xamarin/XMA/Cache/788254b63ea4084823194826a3fb6753': ExitStatus=64
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning : usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning :        cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning : 
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning : An error occurred while uploading files
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning : usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning :        cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning : 
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning :    at Renci.SshNet.SshCommandExtensions.ThrowIfError(SshCommand command) in C:\data\lanes\3513\c4382f51\source\xamarinvs\src\Messaging\Xamarin.Messaging.Client.Ssh\Extensions\SshCommandExtensions.cs:line 24
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning :    at Xamarin.Messaging.Client.Ssh.SshCommands.<RunCommandAsync>d__43.MoveNext() in C:\data\lanes\3513\c4382f51\source\xamarinvs\src\Messaging\Xamarin.Messaging.Client.Ssh\SshCommands.cs:line 523
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning : --- End of stack trace from previous location where exception was thrown ---
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning :    at Xamarin.Messaging.Client.Ssh.SshCommands.<CopyFileAsync>d__19.MoveNext() in C:\data\lanes\3513\c4382f51\source\xamarinvs\src\Messaging\Xamarin.Messaging.Client.Ssh\SshCommands.cs:line 169
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning : --- End of stack trace from previous location where exception was thrown ---
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(528,3): warning :    at Xamarin.Messaging.VisualStudio.MessagingFileManager.<UploadFileAsync>d__10.MoveNext() in C:\data\lanes\3513\c4382f51\source\xamarinvs\src\Messaging\Xamarin.Messaging.VisualStudio\MessagingFileManager.cs:line 140

There's nothing strange with the 'BouncyCastle.AxCrypt' assembly,it's just a private build of BouncyCastle for .NET.
Comment 1 Njål Eide 2016-09-27 17:46:56 UTC
Since I upgraded to latest Xamarin build I are getting some really mysterious crashes, and I get the exact same error as reported here. Maybe related?

If you look closely the path below is not correct. You will see that part of the path is given as ....C:/Users/<UserName> whereas on the Mac no folder with name 'C:' exists (illegal name). It has the name C/


Failed to execute 'cp -f /Users/svante/Library/Caches/Xamarin/mtbs/builds/AxCrypt.XamForms.iOS/f916c117f956aa8f34dfe22acfaab614/C:/Users/Svante/Documents/Visual Studio 2015/Projects/axcrypt-net/BouncyCastle.AxCrypt/bin/Debug/BouncyCastle.AxCrypt.dll
Comment 2 Svante 2016-09-27 18:07:15 UTC
Hi Njål, yes, I noticed this as well. Apart from the fact that it looks really weird, it actually works - and there are lots of files and folders below the funny "C/" folder.

Also, notable, is the fact that the file in question 'BouncyCastle.AxCrypt.dll' is actually there.

So, I'm not quite sure just what is going on or what is actually failing. But it messes up the build anyway. It takes forever, (i.e. couple of minutes) and then the message above is shown.
Comment 3 Jose Gallardo 2016-09-28 16:23:11 UTC
Changing Target Milestone and importance for visibility.

Thanks for reporting, we'll investigate shortly.
Comment 4 Jose Gallardo 2016-10-13 15:45:32 UTC
Hi,

Do you still facing this issue? Can you please add the following information?

1. Xamarin Logs right after a failing build.
Go to the menu "Help - Xamarin - Zip Logs". Please attach that zip file to the bug report. (Please run that command being connected to the Mac, that way we'll get the Mac logs as well).

2. Environment information
Go to the menu "Help - About Microsoft Visual Studio" and press "Copy Info". Please paste that info in a Bugzilla comment.

3. Diagnostic Build Output
Go to the menu "Tools - Options" and from the left panel: "Projects And Solutions - Build And Run" and change "MSBuild Output Verbosity" to "Diagnostic", and then build. Copy the Build Output from the Output window and share it (maybe in a gist or as a zip file).


We cannot repro the issue on our side yet, but that information will surely help.

Thanks!
Comment 5 Svante 2016-10-22 14:24:56 UTC
Yes, it still happens sometimes. Here's the environment information, and I'm attaching the log.zip as well. However, I don't have diagnostic output from the build, since it was not on when this happend. I'm not sure I can leave it on either, because diagnostic level is so much it usually slows down the build to much, but I'll try.

Microsoft Visual Studio Professional 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Professional

Visual Basic 2015   00322-40000-00000-AA292
Microsoft Visual Basic 2015

Visual C# 2015   00322-40000-00000-AA292
Microsoft Visual C# 2015

Visual C++ 2015   00322-40000-00000-AA292
Microsoft Visual C++ 2015

Windows Phone SDK 8.0 - ENU   00322-40000-00000-AA292
Windows Phone SDK 8.0 - ENU

ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11107.0
ASP.NET and Web Tools 2015.1 (Beta8)

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

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

CodeMaid   10.1.93
CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.

Command Bus, Event Stream and Async Manager   Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

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

GhostDoc   4.9.15086.0
GhostDoc automatically generates XML documentation comments.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.4.4
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.

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript   1.8.36.0
TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   14.0.25527.01
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.

VisualHG   1.1.7
Mercurial source contol provider.

Web Compiler   1.11.319
Compiler for LESS, Sass and CoffeeScript files

Windows Installer XML Toolset   3.10.2.2516
Windows Installer XML Toolset version 3.10.2.2516
Copyright (c) Outercurve Foundation. All rights reserved.

Xamarin   4.2.0.703 (3b7df6f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.1.3 (96c7ba6)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.0.1.10 (ad1cd42)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 6 Svante 2016-10-22 14:26:20 UTC
Created attachment 18177 [details]
Zipped logs

These are the zipped logs as requested.
Comment 7 Muck van Weerdenburg 2016-10-25 08:05:45 UTC
I'm seeing this issue as well. The problem is that the path contains spaces and the command's arguments are not escaped properly. If I copy the command in the terminal, I get the same error; after adding quotes around the paths it does work.
Comment 9 Emanuel 2016-11-01 13:51:05 UTC
Fixed in master branch:
Commit: ffc902860bfac56241f9cd17e865d51abc2f0e78
Comment 10 Gonzalo Martin 2017-01-05 18:46:47 UTC
Created attachment 19100 [details]
Zip logs for fixed bug

Verified. Attached logs ("Zip logs for fixed bug").


No error messages shown on build output:

1>------ Build started: Project: App3.iOS, Configuration: Debug iPhoneSimulator ------
1>  Generated session id: 09bc82dc055eb8a59708123b889e07d5
1>  Generated build app name: App3.iOS
1>  Connecting to Mac server 172.17.193.153...
1>  App3.iOS -> C:\Users\gonzalo.martin\git\Globallogic\XamarinTest\App3\App3\App3.iOS\bin\iPhoneSimulator\Debug\App3.iOS.exe
1>  Detected signing identity:
1>    Bundle Id: com.yourcompany.App3
1>    App Id: com.yourcompany.App3
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


Environment's detail:

Microsoft Visual Studio Community 2015
Version 14.0.25425.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Xamarin   4.3.0.524 (ff6c133)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.1.0.16 (4ce2ebd)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.4.0.65 (0366d84)
Visual Studio extension to enable development for Xamarin.iOS.