Bug 22386 - Document errors (com.apple.ibtool.document.errors) from ibtool are ignored, leading to imprecise "source file doesn't exist" error
Summary: Document errors (com.apple.ibtool.document.errors) from ibtool are ignored, l...
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.5
Hardware: PC Windows
: High major
Target Milestone: 3.9
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-08-26 21:59 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2015-01-07 17:41 UTC (History)
6 users (show)

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


Attachments
Test case (13.11 KB, application/zip)
2014-08-26 21:59 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Additional logs (19.42 KB, application/zip)
2014-08-26 22:03 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


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:
Status:
VERIFIED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2014-08-26 21:59:17 UTC
Created attachment 7812 [details]
Test case

XamarinVS 3.5 produces error messages that are difficult to interpret in the case where the "Deployment Target" is set to 5.0 or lower and "Autolayout" is enabled for one or more of the iOS designer documents.

Xamarin Studio for Mac produces more informative messages in this situation.

Unfortunately, the old stable versions (XamarinVS 3.3 and Xamarin Studio 5.2.1.1) did not enforce the agreement between "Deployment Target" and "Autolayout", so users will likely view this as a regression. Improving the error messages in XamarinVS will clarify that this change was intentional.


## Workaround option 1: change the deployment target 

Set "Project Properties -> iOS Application -> Deployment Target" to 6.0 or higher.



## Workaround option 2: disable "Autolayout"

Open each story board one at a time in the iOS designer, and set the "Use Autolayout" checkbox OFF in the Properties window under "Widget [tab] -> Storyboard Document -> Use Autolayout". Be sure to save each storyboard after making this change.




## Steps to reproduce

Attempt to build and debug the attached test case.

OR

1. Create a new "Visual C# -> iOS -> Universal -> Single View App (iOS)" project in Visual Studio.


2. Open each story board one at a time in the iOS designer, and set the "Use Autolayout" checkbox ON in the Properties window under "Widget [tab] -> Storyboard Document -> Use Autolayout". If the checkbox is already ON, switch it OFF and then back ON.


3. Save both storyboards.


4. View the "Project Properties -> iOS Application -> Deployment Target" setting. If it isn't already set to "5.0", set it to "5.0".


5. Attempt to build and debug the app (tested on iOS 7.1 iPhone and iPad simulators).




## Problematic result: Xamarin 3.5.55 (2db5ccd2) + Xamarin.iOS 7.4.0.108 (77efa3f) 


### "View -> Error List" shows some error messages, but they don't point directly to the problem

> Error	1	Cannot copy /Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSUniversalApp1/59f594c4e621f575bb52cc73450f6b16/obj/iPhoneSimulator/Debug/ibtool/MainStoryboard_iPad.storyboardc to /Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSUniversalApp1/59f594c4e621f575bb52cc73450f6b16/bin/iPhoneSimulator/Debug/iOSUniversalApp1.app/MainStoryboard_iPad.storyboardc, as the source file doesn't exist.	C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets	185	3	iOSUniversalApp1
> Error	2	Cannot copy /Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSUniversalApp1/59f594c4e621f575bb52cc73450f6b16/obj/iPhoneSimulator/Debug/ibtool/MainStoryboard_iPhone.storyboardc to /Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSUniversalApp1/59f594c4e621f575bb52cc73450f6b16/bin/iPhoneSimulator/Debug/iOSUniversalApp1.app/MainStoryboard_iPhone.storyboardc, as the source file doesn't exist.	C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets	185	3	iOSUniversalApp1



### The diagnostic MSBuild output doesn't contain any other helpful clues

For example, the IBToolTask appears to complete successfully:

>  Executing task: Xamarin.MacDev.Tasks.IBToolTask (TaskId:11)
>  Tool /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool execution started with arguments: --errors --warnings --notices --output-format xml1 --minimum-deployment-target 5.0 --sdk "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk" --compile "/Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSUniversalApp1/59f594c4e621f575bb52cc73450f6b16/obj/iPhoneSimulator/Debug/ibtool/MainStoryboard_iPad.storyboardc" "/Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSUniversalApp1/59f594c4e621f575bb52cc73450f6b16/MainStoryboard_iPad.storyboard" (TaskId:11)
>  Tool /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool execution finished. (TaskId:11)
>  Tool /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool execution started with arguments: --errors --warnings --notices --output-format xml1 --minimum-deployment-target 5.0 --sdk "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk" --compile "/Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSUniversalApp1/59f594c4e621f575bb52cc73450f6b16/obj/iPhoneSimulator/Debug/ibtool/MainStoryboard_iPhone.storyboardc" "/Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSUniversalApp1/59f594c4e621f575bb52cc73450f6b16/MainStoryboard_iPhone.storyboard" (TaskId:11)
>  Tool /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool execution finished. (TaskId:11)
>Done executing task "IBToolTask". (TaskId:11)



### None of the other logs contain any further clues

- "View -> Output -> Mac Server Log"
- ~/Library/Logs/Xamarin/MonoTouchVS/mtbserver.log
- ~/Library/Logs/Xamarin/MonoTouchVS/iOSUniversalApp1_59f594c4e621f575bb52cc73450f6b16.log





## Good result: Xamarin Studio 5.3 (build 435) + Xamarin.iOS 7.4.0.108 (77efa3f)

"View -> Pads -> Errors -> Build Output" shows a fairly clear error message about the problem:

> Compiling interface definitions
> /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --minimum-deployment-target 5.0 --output-format human-readable-text --compile "/Volumes/ramdisk/iOSUniversalApp1/iOSUniversalApp1/bin/iPhoneSimulator/Debug/iOSUniversalApp1.app/MainStoryboard_iPad.storyboardc" "/Volumes/ramdisk/iOSUniversalApp1/iOSUniversalApp1/MainStoryboard_iPad.storyboard" --sdk "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk"
> /* com.apple.ibtool.document.errors */
> /Volumes/ramdisk/iOSUniversalApp1/iOSUniversalApp1/MainStoryboard_iPad.storyboard:5: error: Auto Layout on iOS Versions prior to 6.0 [12]
> ibtool exited with code 1



## Old result with Xamarin Studio 5.2.1 (build 1) + Xamarin.iOS 7.2.6.28 (606f31a)

The app builds and runs without error.



## Old result with Xamarin 3.3.47 (0b2a1239) + Xamarin.iOS 7.2.6.28 (606f31a)

The app builds and runs without error.



## Result for a corresponding Objective-C app with Xcode 5.1 (5084), Build 5B130a 

The app builds and runs without error.




## Additional version information

### Mac

Mono 3.8.0 (no/62a857e)
Xcode 5.1 (5084), Build 5B130a
OS X 10.9.4


### Windows

Window 8.1 64-bit (in VMWare Fusion 6.0.4)
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2014-08-26 22:03:10 UTC
Created attachment 7813 [details]
Additional logs

... including the full diagnostic MSBuild output and the individual app build log from ~/Library/Logs/Xamarin/MonoTouchVS/iOSUniversalApp1_59f594c4e621f575bb52cc73450f6b16.log
Comment 2 Arpit Jha 2014-08-27 07:08:18 UTC
I have checked this issue and able to reproduce it.

I have tried above steps to reproduce it.

Screencast: http://screencast.com/t/jO3pixy87

Environment Info: 
XVS 3.5.55
Xamarin.iOS 7.4.0.108

I have checked on iPhone Retina(3.5-inch) ios 7.1 simulator
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2014-11-24 17:50:48 UTC
Just to add a bit more explanation for any users who might come across this bug while it still exists, the core of the problem is that the "com.apple.ibtool.document.errors" error output from `ibtool` is discarded.

Running the `ibtool` command from the "IBToolTask" by hand on the Mac build server does produce the desired error message:

> /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool 
>   --errors --warnings --notices --output-format xml1
>   --minimum-deployment-target 5.0 
>   --sdk "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk"
>   --compile "/Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSUniversalApp1/59f594c4e621f575bb52cc73450f6b16/obj/iPhoneSimulator/Debug/ibtool/MainStoryboard_iPhone.storyboardc"
>   "/Users/macuser/Library/Caches/Xamarin/mtbs/builds/iOSUniversalApp1/59f594c4e621f575bb52cc73450f6b16/MainStoryboard_iPhone.storyboard"

> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
> 	<key>com.apple.ibtool.document.errors</key>
> 	<dict>
> 		<key>5</key>
> 		<array>
> 			<dict>
> 				<key>affected-objects</key>
> 				<array>
> 					<string>5</string>
> 				</array>
> 				<key>message</key>
> 				<string>Auto Layout on iOS Versions prior to 6.0</string>
> 				<key>type</key>
> 				<string>IBForbiddenConfiguration</string>
> 				<key>type-value</key>
> 				<integer>12</integer>
> 			</dict>
> 		</array>
> 	</dict>
> 	<key>com.apple.ibtool.document.notices</key>
> 	<dict/>
> 	<key>com.apple.ibtool.document.warnings</key>
> 	<dict/>
> </dict>
> </plist>

And the `ibtool` invocation ends with a failure exit code:
> echo $?
> 1

But the build process currently ignores this error and continues until it hits the secondary problem  where the ".storyboardc" file isn't available (because `ibtool` didn't complete successfully).
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2014-11-25 17:35:00 UTC
I'll bump up the priority of this bug mostly just for record-keeping purposes because there are a few other scenarios where this "silent failure" of `ibtool` causes problems.

For example, if you add a TableView that is set to have "Content -> Static Cells" into a plain UIViewController, then `ibtool` will emit the following for "com.apple.ibtool.document.errors":

> error: Static table views are only valid when embedded in UITableViewController instances

If you build the app that contains this static TableView via Visual Studio (or directly on Mac using the Unified API Xamarin.iOS `xbuild` targets), then `ibtool` fails silently.

If you build the app on Mac using the Classic API `mdtool` build logic, then the build fails at the `ibtool` step, and the "good" error message from `ibtool` appears in the Build Output.
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2014-11-28 15:50:31 UTC
To tidy this up a bit, I'll reduce the severity back down to "Major" because:

a. The target milestone has now been set to 3.9.

b. This bug doesn't itself _cause_ any problems with storyboards. Instead, it "just" makes it difficult for users to determine what problems are present in the storyboards.

c. All of the the Xamarin.iOS template projects now have the "Deployment Target" [1] set to 7.0 or higher, so users won't hit this issue too often. The more likely scenarios will be cases like comment 4, where users have introduced unsupported configurations into the storyboard document.

[1] I checked the "MinimumOSVersion" keys from the `Info.plist` files for all of iOS the templates in XVS 3.8.150.
Comment 8 Ram Chandra 2014-12-08 13:15:37 UTC
I have checked this issue with following builds:

Mac Info:

Mac OS X 10.10.1
Mono 3.12.0 ((detached/ef27535)
GTK+ 2.24.23 (Raleigh theme)
Xcode 6.1 (6604)
Xamarin.iOS : 8.6.0.21 (Trial Edition)

Windows Info:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641
Installed Version: Professional
Xamarin   3.9.125.0 (9f4dfe4)
Xamarin.Android   4.20.0.28 (ba9bbbdd44cfdc4bf485e8885bd2ad24fba525f7)
Xamarin.iOS   8.6.0.0 (22574c9788a6d607f8d119e4d645f5ce5a346553)

I have checked this issue with attached sample which is having "Deployment Target: 5.0" and "Autolayout" checkbox is enabled for storyboard files. When I build the application and deployed into the device (7.1), I observed that I am not getting "source file doesn't exist" error instead of that I am getting following error:

> Auto Layout on iOS Versions prior to 6.0 

I am getting the same behavior with iPhone and iPad simulator.

Screencast: http://www.screencast.com/t/Adr6NxaokVA

This issue has been fixed. Hence I am closing this issue.
Comment 9 Thomas LEBRUN 2015-01-07 16:11:00 UTC
I'm using the latest versions of Xamarin and XamarinVS.

I've just spent more than 4 hrs on the bug that cause this error:

"> error: Static table views are only valid when embedded in UITableViewController instances"

For me, it should be considered as Critical because even if the bug "just" makes it difficult for users to determine what problems are present in
the storyboards, it's really annoying and can be a veritable hell to debug and find the root cause...
Comment 10 Brendan Zagaeski (Xamarin Team, assistant) 2015-01-07 17:41:45 UTC
Note that this bug is currently fixed in the beta channel, and the fix will soon be released to the stable channel. The full ibtool error messages *are* displayed properly in XamarinVS 3.9 (currently available on the beta channel).

Just in the interest of being thorough, note that in this case setting the severity to Critical rather than Major would not have made a difference for when the bug was fixed. The more important field for determining when the bug would be fixed was the Target Milestone. I set the severity to Major in comment 6 only after the Target Milestone had already been set to the soonest upcoming release (3.9).

As with any qualitative scale, the severity scale leaves room for interpretation and debate. One potential conflict with setting the priority to Critical in this case would have been that there are advantages to reserving Critical almost exclusively for major issues that do not have workarounds. As of comment 6, this problem had some available workarounds, and only 1 user had reported to us with a support case where the second, trickier "Static table views" version of the problem (comment 4) turned out to be the root cause.

Hopefully there aren't many (or any) other cases like this left where the real error messages are hard to find. The one trick that comes to mind that might have saved a little time for comment 9 would be to feel free to spend no more than 30 minutes researching error messages like this before emailing the Xamarin support team.