Bug 16421 - InvalidOperationException when debugging or deploying to iOS device
Summary: InvalidOperationException when debugging or deploying to iOS device
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 1.8.x
Hardware: PC Windows
: --- normal
Target Milestone: 1.12 (Merge)
Assignee: dean.ellis
Depends on:
Reported: 2013-11-24 11:03 UTC by Brian
Modified: 2014-01-30 10:35 UTC (History)
7 users (show)

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

Solution that demonstrates the problem (74.47 KB, application/x-zip-compressed)
2013-11-24 11:03 UTC, Brian

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 Brian 2013-11-24 11:03:14 UTC
Created attachment 5520 [details]
Solution that demonstrates the problem

Since build 1.8, the Xamarin.iOS plugin for Visual Studio fails to debug or deploy to an iOS device due to an exception:

  System.InvalidOperationException: The operation cannot be completed because a build is already in progress.
     at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args)
     at Microsoft.Build.Execution.BuildManager.BeginBuild(BuildParameters parameters)
     at Microsoft.Build.Execution.BuildManager.Build(BuildParameters parameters, BuildRequestData requestData)
     at Mono.IOS.VisualStudio.MonoTouchDeploySession.RemoteBuild(VSBuildServerClient server, Project project, IVsOutputWindowPane outputPane, MonoTouchProgressNotifier notifier)

Building locally works fine. It seems to fail as soon as the local machine decides to do a remote build. It doesn't even appear to contact the remote build server.

I am aware of the current bug where the Deploy checkbox on the Build Configuration dialog needs to be unchecked in order for deploying to work. I also tried the suggestion of limiting the parallel builds to one at a time. Neither of these workarounds solves the problem.

I believe I've found a significant clue to this bug. If I use the main menu in Visual Studio and select Build | Clean Solution, Build | Build Solution, and then Debug | Start Debugging, debugging on an iOS device works 10 out of 10 times. However, if I attempt to use the context menu on the project and select Debug | Start new instance, it fails about 25% of the time.

I have attached a simple solution that demonstrates the problem.

Here is my version information:

Microsoft Visual Studio Ultimate 2012
Version 11.0.61030.00 Update 4
Microsoft .NET Framework
Version 4.5.50709

Installed Version: Ultimate

Visual C# 2012   04940-004-0038003-02511
Microsoft Visual C# 2012

Windows Phone SDK 8.0 - ENU   04940-004-0038003-02511
Windows Phone SDK 8.0 - ENU

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

Xamarin.Android   4.10.01073 (d23a19bf)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   1.8.365 (8cb9dbd0)
Visual Studio extension to enable development for Xamarin.iOS
Comment 2 dean.ellis 2013-11-25 04:17:20 UTC
This is a duplicate of an existing internal bug 16066. This has been fixes and should be in the next release.
Comment 3 Mohit Kheterpal 2014-01-30 10:35:00 UTC
Today we have checked this issue with following builds :

VS 2013
Xamarin for VS (3f8cecdd5d00f0366e31218f111ce20c1c216cd0)
Xamarin.iOS (Business Edition)Hash: 8400ec3

Now we are able to build and deploy attached sample on device and simulator successfully.

Hence closing this issue.