Bug 3017 - Exception when syncing Xcode project when Xcode is closed
Summary: Exception when syncing Xcode project when Xcode is closed
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: 2.8.5
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Alan McGovern
URL:
Depends on:
Blocks:
 
Reported: 2012-01-23 12:44 UTC by Jackson Harper
Modified: 2012-01-27 16:43 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Jackson Harper 2012-01-23 12:44:46 UTC
After adding an image to this project, while Xcode is closed, I got this exception:

System.IO.DirectoryNotFoundException: Directory '/Users/jackson/Projects/edictate/edictate/eDictate3/obj/Xcode/6' not found.
  at System.IO.Directory.ValidateDirectoryListing (System.String path, System.String searchPattern, System.Boolean& stop) [0x00000] in <filename unknown>:0 
  at System.IO.Directory+<EnumerateKind>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0 
  at MonoDevelop.MacDev.XcodeSyncing.XcodeMonitor.ScanForAddedFiles (MonoDevelop.MacDev.XcodeSyncing.XcodeSyncBackContext ctx, System.Collections.Generic.HashSet`1 knownFiles, System.String directory, System.String relativePath) [0x000e7] in /private/tmp/source/monodevelop/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs:195 
  at MonoDevelop.MacDev.XcodeSyncing.XcodeMonitor.GetChanges (IProgressMonitor monitor, MonoDevelop.MacDev.ObjCIntegration.NSObjectInfoService infoService, MonoDevelop.Projects.DotNetProject project) [0x00043] in /private/tmp/source/monodevelop/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs:242 
  at MonoDevelop.MacDev.XcodeSyncing.XcodeProjectTracker.SyncXcodeChanges (IProgressMonitor monitor) [0x00017] in /private/tmp/source/monodevelop/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs:345 


Followed by this exception:

System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDevelop.MacDev.XcodeSyncing.XcodeProjectTracker.OpenFileInXcodeProject (System.String path) [0x00056] in /private/tmp/source/monodevelop/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs:166
Comment 1 Jeffrey Stedfast 2012-01-23 16:11:41 UTC
I added a Directory.Exists() before requesting a dir listing which should prevent the first exception, but not sure how it's happening in the first place (I mean, I doubt you rm -rf'd /Users/jackson/Projects/edictate/edictate/eDictate3/obj/Xcode/6 yourself)
Comment 2 Jeffrey Stedfast 2012-01-27 16:43:37 UTC
I think I figured out how the second exception happened (MD got into an inconsistent state due to the first exception).

Added a try-finally around XcodeSyncChanges() so that won't happen.