Bug 2203 - IndexOutOfRangeException when building iPhone app
Summary: IndexOutOfRangeException when building iPhone app
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: Trunk
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Alan McGovern
URL:
Depends on:
Blocks:
 
Reported: 2011-11-26 01:34 UTC by Mikayla Hutchinson [MSFT]
Modified: 2011-11-28 07:33 UTC (History)
1 user (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 Mikayla Hutchinson [MSFT] 2011-11-26 01:34:50 UTC
In some cases there is an error when MD is checking that the app ID matches the provisioning profile:
ERROR [2011-11-25 23:39:00Z]: System.IndexOutOfRangeException: Array index is out of range.
  at MonoDevelop.IPhone.IPhoneBuildExtension.ConstructValidAppId (MonoDevelop.IPhone.MobileProvision provision, System.String bundleId, System.Boolean& exact) [0x00085] in /private/tmp/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Project/IPhoneBuildExtension.cs:1336
  at MonoDevelop.IPhone.IPhoneBuildExtension.GetIdentity (IProgressMonitor monitor, MonoDevelop.IPhone.IPhoneProject proj, MonoDevelop.IPhone.IPhoneProjectConfiguration conf, MonoDevelop.IPhone.IPhoneAppIdentity& identity) [0x0031f] in /private/tmp/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Project/IPhoneBuildExtension.cs:1180
  at MonoDevelop.IPhone.IPhoneBuildExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) [0x001f4] in /private/tmp/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Project/IPhoneBuildExtension.cs:116
Comment 3 Alan McGovern 2011-11-28 07:33:52 UTC
Fixed and also robustified. I tested the changes with this tuples:

var myArray = new [] {
	Tuple.Create ("7V723M9SQ5.*", "7V723M9SQ5.com.xamarin.*"),
	Tuple.Create ("7V723M9SQ5.com", "7V723M9SQ5.com.xamarin.*"),
	Tuple.Create ("7V723M9SQ5.com.xamarin", "7V723M9SQ5.com.xamarin.*"),
	Tuple.Create ("7V723M9SQ5.com.xamarina", "7V723M9SQ5.com.xamarin.*"),
	Tuple.Create ("7V723M9SQ5.com.xamarin.", "7V723M9SQ5.com.xamarin.*"),
	Tuple.Create ("7V723M9SQ5.com.xamarin.foo", "7V723M9SQ5.com.xamarin.*"), // VALID
	Tuple.Create ("7V723M9SQ5.com.xamarin.foo.bar", "7V723M9SQ5.com.xamarin.*"), //VALID
	
	Tuple.Create ("7V723M9SQ5.*", "7V723M9SQ5.com.xamarin.app"),
	Tuple.Create ("7V723M9SQ5.com", "7V723M9SQ5.com.xamarin.app"),
	Tuple.Create ("7V723M9SQ5.com.xamarin", "7V723M9SQ5.com.xamarin.app"),
	Tuple.Create ("7V723M9SQ5.com.xamarina", "7V723M9SQ5.com.xamarin.app"),
	Tuple.Create ("7V723M9SQ5.com.xamarin.", "7V723M9SQ5.com.xamarin.app"),
	Tuple.Create ("7V723M9SQ5.com.xamarin.app", "7V723M9SQ5.com.xamarin.app"),
	Tuple.Create ("7V723M9SQ5.com.xamarin.app.", "7V723M9SQ5.com.xamarin.app"),  // VALID
	Tuple.Create ("7V723M9SQ5.com.xamarin.app.foo", "7V723M9SQ5.com.xamarin.app"),
	Tuple.Create ("7V723M9SQ5.com.xamarin.appa", "7V723M9SQ5.com.xamarin.app"),
};

The first is the generated appid the second is what the profile allows. Only three of the above tuples should be valid if I'm correct in my logic and they are all handled properly. Did I miss any case?