Bug 359 - 4.1 crash with ABPeoplePickercontroller
Summary: 4.1 crash with ABPeoplePickercontroller
Status: RESOLVED DUPLICATE of bug 980
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 4.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-08-22 05:19 UTC by john murray
Modified: 2011-09-29 19:12 UTC (History)
3 users (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 DUPLICATE of bug 980

Description john murray 2011-08-22 05:19:42 UTC
talke any new solution and insert the following code 
the following code runs fine under 4.1 but crashes with no chance of debug in 4.1 
error given is null object reference 

interestingly if one comments out the two delegates -ppvc.Cancel and ppvc.SelectPerson then it will run under 4.1 - however if one reintroduces the delegates even with empty code and no action then the crash reappears 


public partial class AppDelegate : UIApplicationDelegate
	{
protected ABPeoplePickerNavigationController  ppvc=new  ABPeoplePickerNavigationController(); 	
		
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			window.AddSubview (navcontrol.View);
			window.MakeKeyAndVisible ();
	        button.TouchUpInside +=delegate{
			   navcontrol.PresentModalViewController(ppvc,true);
				;};
			ppvc.Cancelled+=delegate(object sender,EventArgs e)
				{				navcontrol.DismissModalViewControllerAnimated(true);
				}  ;
ppvc.SelectPerson+=delegate (object sender,ABPeoplePickerSelectPersonEventArgs args1)
			{	
if (!args1.Continue)
				{ navcontrol.DismissModalViewControllerAnimated(true);}
			} ;			
			return true;
		}
Comment 1 Sebastien Pouliot 2011-08-22 10:06:55 UTC
'navcontrol' is not assigned anywhere so I could be the cause of your NullReferenceException - but that would not explain how it works without the delegates.

Please provide a self-contained test case so we can be sure we'll get the exact same error as you get. Thanks
Comment 2 Sebastien Pouliot 2011-09-29 19:12:35 UTC
Fix available in MonoTouch 4.2.2

*** This bug has been marked as a duplicate of bug 980 ***