Bug 5549 - sample code from Wrox for "iPhone Programming with MonoTo..." is crashing
Summary: sample code from Wrox for "iPhone Programming with MonoTo..." is crashing
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-06-06 08:29 UTC by Jim Goff
Modified: 2015-08-20 14:00 UTC (History)
2 users (show)

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

PickerView01\Main.cs (Chapter 4, Example 6) (1.36 KB, application/octet-stream)
2012-06-06 08:44 UTC, Jim Goff
here's a zip of the whole solution (8.17 KB, application/zip)
2012-06-06 08:47 UTC, Jim Goff

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:

Description Jim Goff 2012-06-06 08:29:01 UTC
Description of Problem:

Sample code downloaded from Wrox website for "Professional  iPhone Programming with MonoTouch and .Net/C#" is out-of-synch with current MonoTouch.  If you run it inside current MonoDevelop, it crashes.  The error message may properly explain the reason, but it's no help to a beginner (like myself).

Interestingly it successfully leaves an executable on the physical device which will run.  However every time I run it on the iPhone simulator in "debug" mode, it will fail.

Steps to reproduce the problem:
1. I downloaded PickerView01 (Listing 4-6)
2. Run it from MonoDevelop in Debug Mode (which will cause a crash)

Actual Results:

2012-06-06 07:59:20.943 PickerView01[15653:1507] Application windows are expected to have a root view controller at the end of application launch

Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.

Expected Results:  No crash

How often does this happen?   Each time

Additional Information:  Here's the Main.cs listing

using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace PickerView01
	public class Application
		static void Main (string[] args)
			UIApplication.Main (args);
	/// <summary>
	/// PickerView01
	/// simple list example
	/// </summary>
	public partial class AppDelegate : UIApplicationDelegate
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
			ListBox.Model = new ListBoxModel (this);
			ListBox.ShowSelectionIndicator = true;
			window.MakeKeyAndVisible ();			
			return true;
		class ListBoxModel : UIPickerViewModel
			AppDelegate app;
			List<string> data;
			public ListBoxModel (AppDelegate appDelegate)
				app = appDelegate;
				data = new List<string> { "Cirrus", "Stratus", "Cumulus", "Fog" };
			public override int GetComponentCount (UIPickerView picker)
				return 1;
			public override int GetRowsInComponent (UIPickerView picker, int component)
				return data.Count;
			public override string GetTitle (UIPickerView picker, int row, int component)
				return data[row];
			public override void Selected (UIPickerView picker, int row, int component)
				app.DisplayText.Text = "You selected " + data[row];

		public override void OnActivated (UIApplication application)
Comment 1 Jim Goff 2012-06-06 08:33:26 UTC
MonoDevelop 3.0.2
Installation UUID: a2495adb-0de0-4d8e-83bb-87f50dd5fa3c
	Mono 2.10.9 (tarball Mon May  7 20:25:51 EDT 2012)
	GTK 2.24.10
	GTK# (
	Package version: 210090011
Apple Developer Tools:
	 Xcode 4.3.2 (1177)
	 Build 4E2002
Monotouch: 5.2.12
Mono for Android not installed
Build information:
	Release ID: 30002000
	Git revision: 046db1bb0d9d438aa4d3468d66c6f963bc44c51a-dirty
	Build date: 2012-05-23 21:39:54+0000
	Xamarin addins: d99a1741642a336943d5607bdc1a09efa2ac3b86
Operating System:
	Mac OS X 10.7.4
	Darwin jims-MacBook-Pro.local 11.4.0 Darwin Kernel Version 11.4.0
	    Mon Apr  9 19:32:15 PDT 2012
	    root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
Comment 2 Jim Goff 2012-06-06 08:44:45 UTC
Created attachment 2023 [details]
PickerView01\Main.cs  (Chapter 4, Example 6)
Comment 3 Jim Goff 2012-06-06 08:47:55 UTC
Created attachment 2024 [details]
here's a zip of the whole solution
Comment 4 Lluis Sanchez 2015-08-20 14:00:36 UTC
Old issue. Should not be a problem with recent releases.