Bug 13907 - Build fails after adding Root.plist with non-string values
Summary: Build fails after adding Root.plist with non-string values
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: 4.0.12
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: master
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2013-08-11 01:20 UTC by Eric Smith
Modified: 2013-08-12 14:24 UTC (History)
2 users (show)

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


Attachments
Sample settings plist with four boolean-valued prefs (1.13 KB, application/octet-stream)
2013-08-11 01:20 UTC, Eric Smith
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 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 Eric Smith 2013-08-11 01:20:35 UTC
Created attachment 4603 [details]
Sample settings plist with four boolean-valued prefs

As discussed on the Xamarin forums.  If you have a Settings.bundle/Root.plist which has Integer or Boolean preferences, the build fails with the following exception:

ERROR [2013-08-11 00:50:36Z]: System.InvalidCastException: Cannot cast from source type to destination type.
  at (wrapper castclass) object:__castclass_with_cache (object,intptr,intptr)
  at MonoDevelop.MacDev.PlistEditor.PDictionary.Get[PString] (System.String key) [0x00022] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.12-branch/593d7acb/source/md-addins/MonoDevelop.MacDev/MonoDevelop.MacDev/PlistEditor/PListObject.cs:591 
  at MonoDevelop.IPhone.IPhoneBuildExtension.UpdateDebugSettingsPlist (IProgressMonitor monitor, MonoDevelop.IPhone.IPhoneProjectConfiguration conf, FilePath target) [0x0013e] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.12-branch/593d7acb/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Project/IPhoneBuildExtension.cs:2491 
  at MonoDevelop.IPhone.IPhoneBuildExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) [0x00c8a] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.12-branch/593d7acb/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Project/IPhoneBuildExtension.cs:370 
  at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) [0x00015] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.12-branch/593d7acb/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:154 
  at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) [0x00016] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.12-branch/593d7acb/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:114
Comment 1 Jeffrey Stedfast 2013-08-12 12:56:08 UTC
Looking over the documentation for PreferenceSpecifiers (Root.plist schema), all of the defined Dictionary children of the PreferenceSpecifiers array have a 'Type' key of type string, none of them allow boolean or integer values for the 'Type' key.

If you want a toggle button, the 'Type' key should contain "PSToggleSwitchSpecifier"

I mean, I can fix the code to be more fault tolerant when reading that file but are you sure it's valid?
Comment 2 Eric Smith 2013-08-12 13:44:52 UTC
Okay, thanks.  Turns out that I was confused by UI of the plist editor.  Entirely my mistake.  Sorry about that.
Comment 3 Jeffrey Stedfast 2013-08-12 14:24:22 UTC
Well, this is still a valid bug :-)

Turns out that fixing this is really just a 1-line patch to our plist Dictionary implementation.

That said, this is now fixed in git master to not throw this exception anymore and handles the error condition much more gracefully.