Bug 2406 - Multiple issues syncing to/from xcode
Summary: Multiple issues syncing to/from xcode
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: Trunk
Hardware: PC Mac OS
: Normal major
Target Milestone: ---
Assignee: Alan McGovern
Depends on:
Reported: 2011-12-07 20:50 UTC by Alan McGovern
Modified: 2012-01-26 05:33 UTC (History)
3 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 or GitHub 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 Alan McGovern 2011-12-07 20:50:05 UTC
There are a fair few issues with MD 2.8.4.x and Xcode. Syncing to xcode sometimes fails because Xcode hangs. Similarly syncing from xcode is apparently being really slow sometimes. We need to figure out why and fix asap.
Comment 1 Alan McGovern 2011-12-08 10:37:06 UTC
I think this has been resolved. I committed a fix or two and stress tested it for a while and encountered no strange hangs or slowdowns with monodevelop master. I did not test the 2.9.1 branch.
Comment 2 Alan McGovern 2011-12-08 10:56:22 UTC
The commit to minimise (or fix?) the hang is this:

--- a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs
+++ b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs
@@ -357,6 +357,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing
                                const string XCODE_OPEN_PROJECT =
 @"tell application ""{0}""
+       activate
        open ""{1}""
 end tell";

The reason for not having the 'activate' there is because if you have your project open in xcode and then add a new xib in monodevelop, the project files are rewritten. When this happens, xcode closes automatically and must be reopened. If we have the 'activate' when reopening we avoid a hang and xcode steals focus. If we do not have it then it xcode might hang but won't steal focus.

I think having it steal focus is the better of the two choices. Though this is another reason why I'd love it if we locked MonoDevelop when xcode is open so that we have one sync-out step when xcode launches and one sync-back step when it is closed and the user cannot modify the MD solution while xcode is open.
Comment 3 Atin 2011-12-29 01:07:05 UTC
Could you please elobrate this issue or provide steps to reproduce so that we can develop more understanding to validate this issue.

Comment 4 Alan McGovern 2012-01-04 12:32:51 UTC
Here are the steps needed to repro the deadlock issue. This is copied/pasted from an email i sent internally a few weeks ago.

I've committed a few changes in the last few days to attempt to work around some deadlocks in Xcode when opening files/projects. Unfortunately the hangs are so infrequent that it's hard for me to tell if they're reduced in frequency or actually fixed. As such, if anyone has some spare cycles and can get a build of MonoDevelop from master and can just double click on xib/storyboard files in MonoDevelop to open them in xcode, that'd be great. If Xcode hangs on startup the applescript will eventually time out and you should get a stacktrace (either in the popup or in your MonoDevelop.log file or in your terminal) which will tell me which applescript snippet it was. I'll need that info to diagnose.

Variations to test include:
1) Opening xibs with xcode closed
2) Opening xibs with xcode open but with no project windows open
3) Opening xibs with xcode open and the project already open
4) Adding new xib files to MonoDevelop while xcode is open and the project is open in xcode