This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 41565 - System.InvalidOperationException: Already bound to project error thrown when opening in Extensions projects created in Xamarin Studio < 6, which contain Components, in Xamarin Studio >= 6
Summary: System.InvalidOperationException: Already bound to project error thrown when ...
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General (show other bugs)
Version: 6.0.0 (C7)
Hardware: Macintosh Mac OS
: High major
Target Milestone: C7SR1
Assignee: Bugzilla
URL:
: 41008 41643 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-06-07 15:28 UTC by Cody
Modified: 2016-06-15 18:46 UTC (History)
5 users (show)

See Also:
Tags: BZRC7S1_C6SR4S1
Is this bug a regression?: Yes
Last known good build: Xamarin Studio 5.10.3 (build 51) (f3c0d98)


Attachments
Sample and Logs (4.37 MB, application/zip)
2016-06-07 15:28 UTC, Cody
Details
Screenshot of the error dialog (20.34 KB, image/png)
2016-06-10 15:49 UTC, Brendan Zagaeski
Details

Description Cody 2016-06-07 15:28:34 UTC
Created attachment 16215 [details]
Sample and Logs

# Description

Using the below linked sample as an example of the issue, an iOS Extension project which contains a component can not be opened in Xamarin Studio 6, due to:

> System.InvalidOperationException: Already bound to project


The sample is based off of the GPS Watch sample located at https://developer.xamarin.com/samples/monotouch/WatchKit/GpsWatch/

The sample opens without issue in Xamarin Studio 6, until a Component is adding. For the sample, I added the SQLIte Component. Once this was added, any attempts to open the solution or extension project again, resulted in the aforementioned error

My current understanding is that the project model has changed, and may have rendered these projects incompatible until ProjectTypesGUID is updated in the project file. In testing, removing: FEACFBD2-3405-455C-9665-78FE426C6842 from <ProjectTypeGuids> in the Extension projects did allow the project to open.


# Logs

Attached

# Sample

Attached

# Steps to Reproduce

1. Download sample
2. Ensure XS version is >= 6.0
3. Open GpsWatch.sln

# Expected Results

Project should open, or alternatively throw an error which is more descriptive

# Actual Results

Error as described above occurs

# Versions

=== Xamarin Studio Business ===

Version 6.0 (build 5174)
Installation UUID: 46f8d89d-cac8-44ab-a9ca-022d9933936d
Runtime:
	Mono 4.4.0 (mono-4.4.0-branch-c7-baseline/5995f74) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000182

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.3.1 (10188.1)
Build 7D1014

=== Xamarin.iOS ===

Version: 9.8.0.323 (Xamarin Business)
Hash: 39ebb77
Branch: cycle7
Build date: 2016-06-01 21:23:15-0400

=== Xamarin.Android ===

Version: 6.1.0.71 (Xamarin Business)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		6.0   (API level 23)

SDK Tools Version: 25.1.6
SDK Platform Tools Version: 23.1.0
SDK Build Tools Version: 23.0.3

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)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Not Installed

=== Xamarin.Mac ===

Version: 2.8.0.323 (Xamarin Business)

=== Build Information ===

Release ID: 600005174
Git revision: 694a75f040b7f2309bc43d4f78a3a6572ca898bf
Build date: 2016-06-01 17:28:08-04
Xamarin addins: 33f406fa2dcf214012c78cb846585f062b2e1d24
Build lane: monodevelop-lion-cycle7-baseline

=== Operating System ===

Mac OS X 10.11.5
Darwin clb-macbook-pro.router 15.5.0 Darwin Kernel Version 15.5.0
	Tue Apr 19 18:36:36 PDT 2016
	root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
Comment 1 Matt Ward 2016-06-07 18:14:52 UTC

*** This bug has been marked as a duplicate of bug 41008 ***
Comment 2 Brendan Zagaeski 2016-06-10 15:23:53 UTC
## Workaround (to highlight the information from Comment 0)

1. Edit `WatchAppExtension/WatchAppExtension.csproj` in a text editor.

2. Remove the string "{FEACFBD2-3405-455C-9665-78FE426C6842};" from the `<ProjectTypeGuids>` element.

3. Save the file.

4. Re-open the solution in Xamarin Studio.




## Additional information

The problem is that `{FEACFBD2-3405-455C-9665-78FE426C6842}` is the ProjectTypeGuid for a Xamarin.iOS _library_ project, and apparently the new project model in Xamarin Studio 6.0 treats that type as mutually exclusive with the the "iOS extension" ProjectTypeGuid `{EE2C853D-36AF-4FDB-B1AD-8E90477E2198}`.

_Every_ existing iOS extension sample project in monotouch-samples will hit this conflict [1].

[1] https://github.com/xamarin/monotouch-samples/search?utf8=%E2%9C%93&q=EE2C853D-36AF-4FDB-B1AD-8E90477E2198&type=Code




## Possible improvements


A. At the least, this error condition should produce an error message that precisely indicates the cause of the problem.  For example, something like:

"Load operation failed: The project contains 2 conflicting items in the <ProjectTypeGuids> element: {FEACFBD2-3405-455C-9665-78FE426C6842} and {EE2C853D-36AF-4FDB-B1AD-8E90477E2198}.  You will need to remove one of these elements to load the project successfully.  Please consult the list of known <ProjectTypeGuids> here."

- The list of conflicting ProjectTypeGuids should be generated dynamically based on the particular conflict because (as demonstrated in non-public Bug 41008), there are other pairs of conflicting ProjectTypeGuids in existing user projects.

- The word "here" must be linked to a document that lists all of the correct ProjectTypeGuids for each type of project.



B. If possible, perhaps the simpler option would be to re-allow "conflicting" ProjectTypeGuids to exist side-by-side in Xamarin Studio 6.0 as was possible in Xamarin Studio 5.10.  We could then revisit how to migrate users more smoothly to cleaner ProjectTypeGuids in a future feature release.



Thanks!
Comment 3 Brendan Zagaeski 2016-06-10 15:34:52 UTC
> _Every_ existing iOS extension sample project in monotouch-samples will hit this conflict

Actually, it's a bit more subtle than that.  None of those sample projects hit the error directly "out of the box."  But if you add a Component to any one of them, _then_ you will hit the error.
Comment 4 Brendan Zagaeski 2016-06-10 15:35:19 UTC
*** Bug 41008 has been marked as a duplicate of this bug. ***
Comment 6 Brendan Zagaeski 2016-06-10 15:49:50 UTC
Created attachment 16278 [details]
Screenshot of the error dialog

## Additional Results

Users who hit the problem will likely notice the error dialog messages before they go to check the Xamarin Studio log files, so I am adding those error dialog messages to this bug report.


### Error Dialog messages

> Could not load solution: /Users/Shared/Projects/GpsWatch/GpsWatch.sln
> 
> Load operation failed.
Comment 9 Cody 2016-06-13 16:15:04 UTC
This also appears to be a problem with certain Android projects which contain bindings. For example:

Given a test project (Test.csproj) with two ProjectTypesGUID: {EFBA0AD7-5A72-4C68-AF49-83D382785DCF} and {10368E6C-D01B-4462-8E8B-01FC667A7035} the project will fail to load. This is because the first ID corresponds to a regular Android project. The second one is for an Android Binding library project. The problem can be solved by removing the {EFBA0AD7-5A72-4C68-AF49-83D382785DCF} GUID from the .csproj

Thanks!
Comment 10 Brendan Zagaeski 2016-06-13 18:14:59 UTC
*** Bug 41643 has been marked as a duplicate of this bug. ***
Comment 11 xamarin-release-manager 2016-06-14 09:14:01 UTC
Fixed in version 6.0.2.2 (cycle7)

Author: Lluis Sanchez Gual
Commit: bb8519c8547e819df8a3bec23a0c6a38f18a53fd (xamarin/md-addins)
Included in Commit: b440588804cb4a47a533edd76a6141d14089ba89 (mono/monodevelop)
Comment 12 xamarin-release-manager 2016-06-14 09:17:48 UTC
Fixed in version 6.0.1.2 (cycle7-sr0)

Author: Lluis Sanchez Gual
Commit: 5df1053387c0725d00b2a0d68452ec08cdb400b2 (xamarin/md-addins)
Included in Commit: de35e2b57e52ea0b641331e0d8da60fe43c49799 (mono/monodevelop)
Comment 13 Shruti 2016-06-15 10:51:22 UTC
*********************
Reproduce Status:
*********************
I am able to reproduce this issue with attached project on latest stable XS XamarinStudio-6.0.0.5174
Screencast: http://www.screencast.com/t/jgwLObKJx9F

*******************
Verify Status:
*******************
This issue is working fine with XS 6.0.1. 2 (monodevelop-lion-cycle7-sr0). Attached project is loading successfully now.
Screencast: http://www.screencast.com/t/2UoDpLuyLs
Environment Info: https://gist.github.com/shrutis360/d8ceca8c36c8c68b0966f895c4699732
Comment 14 xamarin-release-manager 2016-06-15 18:46:05 UTC
Fixed in version 6.0.2.19 (cycle7-app-insights-rebased)

Author: Lluis Sanchez Gual
Commit: bb8519c8547e819df8a3bec23a0c6a38f18a53fd (xamarin/md-addins)
Included in Commit: 24e2e39bdd454985009b99965de7722eb8d0cbcc (mono/monodevelop)

Note You need to log in before you can comment on or make changes to this bug.