Bug 17696 - Xamarin.iOS VS deploy broken from background thread usage
Summary: Xamarin.iOS VS deploy broken from background thread usage
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 1.12.x
Hardware: PC Mac OS
: --- normal
Target Milestone: 1.12 (Merge)
Assignee: dean.ellis
Depends on:
Reported: 2014-02-11 04:45 UTC by dean.ellis
Modified: 2014-05-09 09:29 UTC (History)
6 users (show)

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

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 dean.ellis 2014-02-11 04:45:19 UTC
from case #60719

"Recently when I've been deploying my iOS app from VS to the remote Mac builder host, it's been failing with this text in the output window:

1>Microsoft.Assumes+InternalErrorException: An internal error occurred. Please contact Microsoft Product Support Services.

1> at Microsoft.Assumes.Fail(String message, Boolean showAssert)

1> at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.GlobalProjectCollectionWatcher.PostUpdateGlobalPropertiesSnapshot()

1> at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.GlobalProjectCollectionWatcher.GlobalProjectCollection_ProjectCollectionChanged(Object sender, ProjectCollectionChangedEventArgs e)

1> at Microsoft.Build.Evaluation.ProjectCollection.OnProjectCollectionChanged(ProjectCollectionChangedEventArgs e)

1> at Microsoft.Build.Evaluation.ProjectCollection.SetGlobalProperty(String name, String value)

1> at Mono.IOS.VisualStudio.MonoTouchDeploySession.RemoteBuild(VSBuildServerClient server, Project project, IVsOutputWindowPane outputPane, MonoTouchProgressNotifier notifier)========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

It just so happens I'm familiar with the VS code on the top of the exception stack (I wrote it, as a member of the Visual Studio team!). It's failing because the caller (the last frame on the stack above) is setting an MSBuild global property while on a background thread. This is not a thread-safe operation, and can cause the product to crash. The top of the callstack is recognizing this incorrect thread and throwing as a result. 

Please issue an update to Xamarin.JOS tools for VS that doesn't set global properties on background threads. In fact, I would venture to go as far as please don't ever set global properties on the ProjectCollection at all -- they impact all projects in the solution, including ones that have nothing to do with Xamarin and may have unexpected side-effects. It's preferable to set global properties only on individual projects.


Andrew Arnott
Comment 1 dean.ellis 2014-02-18 10:18:07 UTC
Fixed in XamarinVS/master/a1c55a7460
Comment 2 Marcel Bradea 2014-05-08 18:13:24 UTC
Is there a workaround for this issue until this makes it in the next release?
We currently cannot work on our iOS app at all, since both the simulator and device deployments are affected by this.

Alternatively can we get a nightly build that has this issue fixed?
Comment 3 Saurabh 2014-05-09 08:39:48 UTC
I am trying to verify this issue with latest  Xamarin for VS 1.12.278

I am able to build and deploy iOS application on Mac build host successfully.  

Could you please provide a small test case or a sample test project to verify this issue?
However, I am able to build and deploy iOS applications on Mac build host successfully.
Comment 4 Marcel Bradea 2014-05-09 09:29:38 UTC
It seems the Xamarin tools were not at the latest version, even though I just installed them on a newly-imaged machine on Tuesday of this week. The installed version was:
- Xamarin.iOS 1.10.47 (Windows)
- Xamarin.iOS Build Host (Mac)

Anyways went in to Options > Xamarin and did a manual version check which brought it to the latest version.

Confirmed issue is fixed in 1.12.275