Prior to the iOS 11 related releases of Visual Studio for Mac and Xcode, I was able to open a solution in VS from a Windows share, do my storyboard editing in Xcode, and then click back to VS to sync the changes. I do everything else for the project from Windows.
After updating, however, the Xcode 9 assistant editor shows no results when clicking a view controller. If I manually open the .h file in the assistant editor and try to add an outlet, it throws an error. The 7.4 build 45 release from bug 58198 resolved this problem only when loading a solution that is stored directly on the Mac. The problems persist when working from a Windows share (whether it is SMB or AFP).
Created attachment 24967 [details]
Opening Xcode from Visual Studio
Created attachment 24968 [details]
No assistant results after indexing completes
Created attachment 24969 [details]
Error creating outlet after manually opening .h file
An workaround i used is.
To add the reference in vs for mac. Xcode will pick it up.
Its the name attribute of identity
Thanks for the bug report. To further diagnose the issue, we need some additional information.
1) In the Xamarin Studio About box, click on Show Details and then on Copy Information, then add the information to the bug report.
2) Click on the command Help -> Open Log Directory, then attach the latest IDE log file.
Created attachment 24995 [details]
Visual Studio About details
Created attachment 24996 [details]
Latest Visual Studio IDE log
Information has been provided.
Happens with all versions of Visual Studio Mac.
7.1, 7.2 and even 7.4
Works fine with the same project when it is not on the windows share.
*** Bug 59846 has been marked as a duplicate of this bug. ***
Could you also fix:
- file not found popup when opening the storyboard in xcode
- storyboard file not selected when xcode opens
- storyboard files mixed with fake .m/.h source files in a flat folder. Use subfolders instead to make it easy to select storyboard files.
And finally fix:
- vsmac incorrectly creates .designer.cs files for all 'exported' classes in the solution when opening a storyboard in vsmac storyboard editor.
- vsmac adds png/jpg files it finds in the resource folder to any storyboard when opening a storyboard in vsmac storyboard editor.
- vsmac changes the order of items in plist files (from the vs windows counterpart, especially icons), making tracking change by git a mess
- vsmac removes empty xml tags in csproj, tags added by vs windows, making tracking change by git a mess
> Could you also fix:
> - file not found popup when opening the storyboard in xcode
I don't get this error
> - storyboard file not selected when xcode opens
The storyboard is selected for me when I open in Xcode...
> - storyboard files mixed with fake .m/.h source files in a flat folder. Use subfolders instead to make it easy to select storyboard files.
They need to be in a flat folder or Xcode9 won't find them. I literally just had to commit a patch to put them in a flat folder because Xcope9 wasn't finding them otherwise and so if you tried to add an Outlet, Xcode9 would say "Cannot find source file for class ViewController" even though you literally just dragged&dropped an Outlet to ViewController.h.
> And finally fix:
> - vsmac incorrectly creates .designer.cs files for all 'exported' classes in the solution when opening a storyboard in vsmac storyboard editor.
This is done on purpose because otherwise there's no way to add codebehind. We can't safely add it to the non-designer .cs file or we would risk clobbering your code.
> - vsmac adds png/jpg files it finds in the resource folder to any storyboard when opening a storyboard in vsmac storyboard editor.
This isn't a bug. It does this by design. We have no idea what images you are using and which ones you *might* want to use from Xcode, so we have to export them all.
Created attachment 25118 [details]
file not found popup when opening the storyboard in xcode
- file not found popup when opening the storyboard in xcode
I get that all the time with the version 7.2 of VS Mac.
See my pic capture
The problem is the path: the "resource" folder does not exist in "obj/xcode/0" because you are flattening the hierarchy.
So if you don't get xcode error, then you have a build of vs that i don't.
I use 7.2 build 634
Thanks. Comment #16 is extremely useful info... Cooking up a fix now.
Any news when this will be available ?
A private build maybe ?
It is *extremly* annoying.
## Bookkeeping status update
The pull request from Comment 18 has now been merged into the "master" development branch (md-addins/0467620a8c6ee41b7846c5d59cabe83499d17f59). This means that by default the candidate fix will be included in the next version of Visual Studio for Mac that is branched from the "master" development branch. At the moment, that aligns with the "15.6" Target Milestone as indicated in the "Target Milestone" field of this bug. The timeline for the first previews that include that candidate fix are still a little ways off since they would fall after the current "15.5" Target Milestone preview (Visual Studio 2017 for Mac version 7.3 Preview) moves to non-preview.
That said, because there are a few users (3 currently) following this bug report who might find it useful to be able to go back as soon as possible to their old Xcode 8 workflow for editing files directly off of Windows share folders (rather than having to copy the projects back and forth), I will send a request to the Visual Studio for Mac team about the possibility of backporting the candidate change to the Visual Studio 2017 for Mac version 7.3 Preview (the "15.5" Target Milestone). In considering that request, the team will assess the level of risk associated with the fix and the suitability of additional changes to the version 7.3 Preview at this time.
I've back-ported the fix to the 15.5 milestone here: https://github.com/xamarin/md-addins/pull/2640
*** Bug 60362 has been marked as a duplicate of this bug. ***
Fixed in version 18.104.22.1689 (d15-5)
Author: Jeffrey Stedfast
Commit: b175e456f3b43cb02ee16e5fbfb92ff407f3e965 (xamarin/md-addins)
Included in Commit: a0a9119bc4056463c3780f9597fde5323a7d94e1 (mono/monodevelop)
Since the target milestone is 15.5 and that has now been released, should this fix now be in place? I just updated VS Mac and Xcode to the latest versions and experienced the same behavior as before.
Also no difference with 15.5.1.
## Partial workaround found as part of Experiment 2 (from below)
After opening the storyboard in Xcode (after step 6 of the steps to test below), set "File > Project Properties > Derived Data" in Xcode to "Custom Location" and set the path to a local folder like /private/tmp/DerivedData1 (or whatever other local folder you prefer).
Admittedly since this workaround step must be repeated each time the storyboard is opened, it might not be much more convenient than copying the whole solution directory back and forth.
Experiment 3 below indicates that this issue with the location of the DerivedData affects plain Xcode projects as well with no involvement of Xamarin or Visual Studio.
I will reopen this bug for a little further consideration of whether it might be worth adding some logic in the Visual Studio for Mac Tools for Xamarin to handle this scenario automatically for users (as an enhancement).
## Verification status: not yet fixed for my test environment with the latest released version
> BAD: Visual Studio 2017 for Mac (22.214.171.1249) (df59042) (Xamarin addins: 51068d6)
The non-public change from Comment 18 and Comment 22 is included in this version, but based on my new results I wouldn't expect that change to resolve this issue, at least for my testing environment. For a tiny bit of additional context, the change is related to adjusting the lookup path used to open the generated Xcode project.
## Steps followed to test
1. Share a folder from a Windows computer, allowing read/write privileges.
2. Connect to the shared folder with the Samba protocol in macOS using "Go > Connect to Server" in Finder.
3. Create a new "iOS > App > Single View App" iPhone app in Visual Studio for Mac in the Windows share folder. (Note: I tried creating the project directly on the share or moving it, and I didn't notice any differences in behavior between those 2 options.)
4. Open the project again in Visual Studio for Mac.
5. Control-click the Main.storyboard file and select "Xcode Interface Builder".
6. After Xcode opens the project, wait for the "Indexing" status to complete in the Xcode status bar.
7. Ensure the storyboard is open in the main window, and open the Assistant editor.
## BAD Results with Xcode 9.0 (9A235)
a. The Assistant editor shows "No Assistant Results".
b. If you add a button to the storyboard, navigate to ViewController.h using the Manual drop-down menu in the Assistant editor, and then try to control-click and drag to create an Outlet or Action for the button, you will get the error:
"Could not insert new outlet connection: Could not find any information for the class named ViewController"
## GOOD Results with Xcode 8.3.3 (8E3004b) on a Windows share, or with Xcode 9.0 when using a local project directory
a. The Assistant editor automatically selects the ViewController.m file (once the "Indexing" status completes).
b. Adding an Outlet or Action is successful.
## Experiment 1
1. Run the "Xcode Interface Builder" with Xcode 9.0 from a local directory.
2. Copy the "good" generated obj/Xcode directory to the Windows share.
3. Open the .xcodeproj from that directory in Xcode.
Result: BAD. The BAD behaviors occur.
## Experiment 2
1. Follow the steps from Experiment 1.
2. Now delete the file "*.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad/WorkspaceSettings.xcsettings" from the obj/Xcode directory. Or delete following lines from that file.
3. Again open the .xcodeproj in Xcode.
Interestingly, since /private/tmp/DerivedData1 _does_ work for the custom location, the "good" behavior evidently does _not_ depend on Spotlight indexing (/private/tmp is not indexed). Maybe there is instead some file metadata that Xcode 9.0 now writes that can't be written on the Windows share?
## Experiment 3
1. Create an Objective-C iOS project in Xcode on the Windows share.
2. Under "File > Project Properties > Derived Data" select "Project-relative Location", and leave the default "DerivedData" value.
Result: BAD. The same 2 bad behaviors occurs as observed for the Xcode project generated by Visual Studio for Mac.
(Note that this scenario does not involve Xamarin or Visual Studio for Mac at all.)
## Additional testing environment info
Mono Framework MDK 126.96.36.199 (2017-06/e66d9abbb27) (64-bit)
## Testing notes about a behavior in my environment that might affect my specific results
The obj/Xcode directory does not get fully deleted as it should from the Windows share after I quit Xcode in my environment and bring Visual Studio for Mac back to the foreground. This seems to be separate from the issue in this bug report because it affects both Xcode 9.0 and Xcode 8.3.3 in my environment. I believe it is a peculiarity in my testing environment because I ran into the same problem even when just saving files in a Swift project in Xcode.
Thanks for the information. Changing the derived data folder to a local one is a good enough workaround for now.