Bug 35234 - [XVS 3.11.1585] Timing-dependent error when building iOS binding projects: "The "BTouch" task failed unexpectedly ... Access to the path '... obj\Debug\ios\ObjCRuntime' is denied"
Summary: [XVS 3.11.1585] Timing-dependent error when building iOS binding projects: "T...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.11 (C5)
Hardware: PC Windows
: --- normal
Target Milestone: 3.11.x (iOS9.1)
Assignee: Bugzilla
Depends on:
Reported: 2015-10-24 04:45 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2015-10-27 08:00 UTC (History)
4 users (show)

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

Log files (22.14 KB, application/zip)
2015-10-24 04:45 UTC, Brendan Zagaeski (Xamarin Team, assistant)

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:

Description Brendan Zagaeski (Xamarin Team, assistant) 2015-10-24 04:45:25 UTC
Created attachment 13518 [details]
Log files

[XVS 3.11.1585] Timing-dependent error when building iOS binding projects: "The "BTouch" task failed unexpectedly ... Access to the path '... obj\Debug\ios\ObjCRuntime' is denied"

## Regression status: this appears to be a regression in the "iOS 9.1 + OS X 10.11" release (aka "Cycle 5 SR 5")

> BAD:  XamarinVS 3.11.1585.0 (7b9e289) + Xamarin.iOS (7426bd7) + Mono 4.0.5 (1d8d582)

- 5 failures, 0 successes on OS X 10.10 and 10.11 VMs.

> GOOD: XamarinVS 3.11.1537.0 (a11147b) + Xamarin.iOS (1d27ac2) + Mono 4.0.5 (1d8d582)

- 0 failures, 5 successes on the OS X 10.10 VM.

- 0 failures, 5 successes on the OS X 10.11 VM, after applying an environment variable workaround for the path problem (Bug 34743):

launchctl setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

(Thanks to http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x)

## Steps that allowed me to reproduce consistently

1. Open Visual Studio in Windows 8.1 (64-bit) running under VMWare Fusion 6.0.6 on a Mac VM host.

2. In Visual Studio create a new "Visual C# -> iOS -> Bindings Library (iOS)" project, or use any existing iOS bindings library.

3. Open an OS X 10.10 Yosemite or OS X 10.11 El Capitan VM on the same Mac VM host, running under the same VMWare Fusion 6.0.6.

4. Attempt to build the binding project while Visual Studio in the Windows VM is paired to the build host running in the Mac VM.

Importantly I was _never_ able to reproduce the problem when I ran the build host directly on the Mac host OS. I would almost blame unusual write or read permissions caused by the VM software, except (a) the same problem was also seen with a physical OS X 10.11 build host in Bug 34743, Comment 19, and (b) as demonstrated above, the problem is a regression.

## Results

The build fails:

> The "BTouch" task failed unexpectedly.
> System.UnauthorizedAccessException: Access to the path '\Users\macuser\Library\Caches\Xamarin\mtbs\builds\UnifiedIosBindingsLibrary1\79609b8243270ea2124460e5370cbc06\obj\Debug\ios\ObjCRuntime' is denied.
>    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
>    at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
>    at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
>    at System.IO.Directory.CreateDirectory(String path)
>    at MonoTouch.Tools.Build.RemoteBuilder.GetFile(String path) in c:\w\7b9e2895\XamarinVS\Tools\MonoTouch.Tools\Build\RemoteBuilder.cs:line 91
>    at Xamarin.iOS.Tasks.BTouch.GetGeneratedSources(TaskRunner taskRunner) in c:\w\7b9e2895\XamarinVS\msbuild\Xamarin.iOS.Tasks\Tasks\BTouchTask.cs:line 49
>    at Xamarin.iOS.Tasks.BTouch.Execute() in c:\w\7b9e2895\XamarinVS\msbuild\Xamarin.iOS.Tasks\Tasks\BTouchTask.cs:line 35
>    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
>    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
Comment 2 Saurabh 2015-10-27 08:00:48 UTC
I am able to reproduce this Issue with XVS 3.11.1585 + X.iOS This is the build output: https://gist.github.com/saurabh360/d2d7c8a0a4ce9929a161. To reproduce this Issue I have followed following steps:

1. Create iOS single view template on main windows 8.1 machine.
2. Add iOS Binding library to this solution and add reference of binding project to main project.
3. Connect VS to Yosemite's VM Build host on mac machine.
4. Build the application.

I have checked it with XVS 3.11.1589 and X.iOS Now project getting build successfully. This is the build output: https://gist.github.com/saurabh360/10a3fa7d50a4c9bb1fd0