Bug 5047 - Using Settings -> Build -> iPhone Application causes exception
Summary: Using Settings -> Build -> iPhone Application causes exception
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: 2.9.x
Hardware: Macintosh Mac OS
: High normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2012-05-13 08:00 UTC by Nic Wise
Modified: 2012-05-14 12:17 UTC (History)
1 user (show)

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


Attachments
Info.plist which has some of the errant bits in it. (926 bytes, application/octet-stream)
2012-05-13 08:00 UTC, Nic Wise
Details
working plist (1.16 KB, application/octet-stream)
2012-05-13 16:59 UTC, Nic Wise
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 Nic Wise 2012-05-13 08:00:43 UTC
Created attachment 1866 [details]
Info.plist which has some of the errant bits in it.

Hi there

I'm not sure if this is in MT, or MD.

I've tried it with MD 3 (yay!) and MT 5.2.11 and 5.3.latest. Same in both cases.

When I try to edit the iPhone properties (bundle version, name etc - all the stuff out of Info.plist), I get the exception below.

I can edit the plist in xcode fine.

I've attached the plist file to this, too.


System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_castclass (object,intptr)
  at MonoDevelop.MacDev.PlistEditor.PDictionary.Get[PBoolean] (System.String key) [0x0001c] in /Users/builder/data/lanes/monodevelop-mac-3.0.0/bd819ea0/source/monodevelop/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/PListObject.cs:413 
  at MonoDevelop.IPhone.PlistEditor.IPhoneIcons.Update () [0x0000c] in /Users/builder/data/lanes/monodevelop-mac-3.0.0/bd819ea0/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/PlistEditor/IPhoneIcons.cs:154 
  at MonoDevelop.IPhone.PlistEditor.IPhoneIcons..ctor (MonoDevelop.Projects.Project project, MonoDevelop.MacDev.PlistEditor.PDictionary dict, MonoDevelop.IPhone.PlistEditor.PlistIconFileManager iconFileManager, MonoDevelop.IPhone.PlistEditor.LaunchImageFileManager launchImageFileManager) [0x0032f] in /Users/builder/data/lanes/monodevelop-mac-3.0.0/bd819ea0/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/PlistEditor/IPhoneIcons.cs:114 
  at MonoDevelop.IPhone.PlistEditor.IPhonePlistEditingHandler+<GetSections>c__IteratorB.MoveNext () [0x0013c] in /Users/builder/data/lanes/monodevelop-mac-3.0.0/bd819ea0/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/PlistEditor/IPhonePlistEditingHandler.cs:69 
  at MonoDevelop.MacDev.PlistEditor.PListEditorWidget.SetPListContainer (MonoDevelop.MacDev.PlistEditor.PObjectContainer container) [0x0013f] in /Users/builder/data/lanes/monodevelop-mac-3.0.0/bd819ea0/source/monodevelop/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/PListEditorWidget.cs:77 
  at MonoDevelop.IPhone.Gui.IPhoneOptionsPanel.CreatePanelWidget () [0x0005f] in /Users/builder/data/lanes/monodevelop-mac-3.0.0/bd819ea0/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Gui/IPhoneOptionsPanel.cs:57 
  at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.CreatePageWidget (MonoDevelop.Ide.Gui.Dialogs.SectionPage page) [0x00030] in /Users/builder/data/lanes/monodevelop-mac-3.0.0/bd819ea0/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs:505 
  at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.ShowPage (MonoDevelop.Ide.Extensions.OptionsDialogSection section) [0x00132] in /Users/builder/data/lanes/monodevelop-mac-3.0.0/bd819ea0/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs:402 
  at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.OnSelectionChanged (System.Object s, System.EventArgs a) [0x0002a] in /Users/builder/data/lanes/monodevelop-mac-3.0.0/bd819ea0/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs:355 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d5] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.Reflection/MonoMethod.cs:226 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.Reflection/MonoMethod.cs:234 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.Reflection/MethodBase.cs:96 
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000bf] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System/Delegate.cs:408 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00018] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System/Delegate.cs:382 
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0 
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0 
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0 



-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Earnest: Self-employed? Track your business expenses and income. http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket. http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
Comment 1 Nic Wise 2012-05-13 16:59:05 UTC
Strangely enough, another project works fine.... Attached it's plist.
Comment 2 Nic Wise 2012-05-13 16:59:41 UTC
Created attachment 1871 [details]
working plist
Comment 3 Jeffrey Stedfast 2012-05-13 18:32:20 UTC
From a quick look at the Info.plist you attached, it's the "Prerendered Icons" key/value pair that is breaking things. MonoDevelop expects that to be a Boolean value (not a string).

The docs here suggest the value should be of type Boolean:

https://developer.apple.com/library/ios/#documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW16


*HOWEVER* that doesn't mean your Info.plist is wrong, as I've noticed that Apple isn't always consistent with enforcing certain types of values for some of their keys at least.

Assuming that iOS correctly interprets your Info.plist, we should make MonoDevelop handle them too.

This should be an easy fix to make sure that we can handle loading a string value in this case as well as the bool that we expected.
Comment 4 Nic Wise 2012-05-14 02:18:31 UTC
Thanks Jeff

Yes, the plist works as-is in everything except MD. However, I think it was created WITH MD, rather than via xcode... so MD was setting the wrong value maybe?

At least it's an easy fix at my end.
Comment 5 Nic Wise 2012-05-14 02:24:43 UTC
Yup, confirmed, that fixed it. I wonder if it's cos the older MD's didn't have a pre-rendered tick box, but the new one does? It was wrong before, but nothing was checking for it...
Comment 6 Mikayla Hutchinson [MSFT] 2012-05-14 11:15:13 UTC
We certainly shouldn't display the exception, anyway. I wonder what the best way to display such errors is.
Comment 7 Mikayla Hutchinson [MSFT] 2012-05-14 11:15:13 UTC
We certainly shouldn't display the exception, anyway. I wonder what the best way to display such errors is.
Comment 8 Jeffrey Stedfast 2012-05-14 12:17:41 UTC
Fixed in git master and the 3.0-series branch to handle string values