Bug 12893 - Issue with EKEventEditViewController on iPad 1 (iOS 5.1.1) terminating the app
Summary: Issue with EKEventEditViewController on iPad 1 (iOS 5.1.1) terminating the app
Status: RESOLVED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.3.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-06-26 07:56 UTC by John Hair
Modified: 2013-06-26 10:04 UTC (History)
2 users (show)

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


Attachments
Example project (147.04 KB, application/zip)
2013-06-26 07:56 UTC, John Hair
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 INVALID

Description John Hair 2013-06-26 07:56:14 UTC
http://forums.xamarin.com/discussion/comment/18193#Comment_18193

Ive added an attachment that runs with example code pasted into your HelloVS example button click event. The issue has now been reported by 2 iPad1 users, both on iOS 5.1.1.

Side note relating to a different bug report I created with breakpoints breaking in the wrong place in Visual Studio, when running the above example and putting a breakpoint in MyViewController.cs at line 46, run the app, tap the button and step through the code to the for each loop, in iOS6 it will loop 4 times, keep pressing F10 and the debug line will flip past the end of the unit. F10 back again to where it should be, F10 again off the end of the file again.



Cheers

John
Comment 1 John Hair 2013-06-26 07:56:58 UTC
Created attachment 4202 [details]
Example project
Comment 2 Sebastien Pouliot 2013-06-26 09:09:11 UTC
Accessing `controller.ViewControllers[0].View` provokes a deep, native crash inside WebKit.

Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: Thread 0 Crashed:
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 0   JavaScriptCore                	0x33c47e30 0x33c46000 + 7728
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 1   WebCore                       	0x378ef026 0x378e9000 + 24614
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 2   WebCore                       	0x378ef106 0x378e9000 + 24838
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 3   WebCore                       	0x378ec9d6 0x378e9000 + 14806
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 4   WebCore                       	0x378ec2ca 0x378e9000 + 13002
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 5   WebCore                       	0x378ebec0 0x378e9000 + 11968
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 6   WebCore                       	0x378ebb04 0x378e9000 + 11012
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 7   WebCore                       	0x378eeb52 0x378e9000 + 23378
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 8   WebCore                       	0x379ae630 0x378e9000 + 808496
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 9   WebKit                        	0x349c93d0 0x349c7000 + 9168
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 10  WebKit                        	0x349c8d60 0x349c7000 + 7520
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 11  WebKit                        	0x349c8b10 0x349c7000 + 6928
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 12  UIKit                         	0x334068fc 0x333f3000 + 80124
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 13  UIKit                         	0x334068a6 0x333f3000 + 80038
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 14  UIKit                         	0x33405818 0x333f3000 + 75800
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 15  UIKit                         	0x3341e454 0x333f3000 + 177236
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 16  UIKit                         	0x33413c5c 0x333f3000 + 134236
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 17  UIKit                         	0x333f9f30 0x333f3000 + 28464
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 18  CoreFoundation                	0x35c551f4 0x35c3d000 + 98804
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 19  QuartzCore                    	0x32e20a9e 0x32e1b000 + 23198
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 20  QuartzCore                    	0x32e206b6 0x32e1b000 + 22198
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 21  UIKit                         	0x334436be 0x333f3000 + 329406
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 22  UIKit                         	0x3344b502 0x333f3000 + 361730
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 23  UIKit                         	0x33423db2 0x333f3000 + 200114
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 24  UIKit                         	0x3344d214 0x333f3000 + 369172
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 25  UIKit                         	0x3344ad70 0x333f3000 + 359792
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 26  UIKit                         	0x3344a65e 0x333f3000 + 357982
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 27  UIKit                         	0x33436322 0x333f3000 + 275234
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 28  UIKit                         	0x3344df36 0x333f3000 + 372534
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 29  UIKit                         	0x33424422 0x333f3000 + 201762
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 30  UIKit                         	0x3344a076 0x333f3000 + 356470
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 31  EventKitUI                    	0x3624fb7c 0x3622e000 + 138108
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 32  UIKit                         	0x3342fc84 0x333f3000 + 248964
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 33  UIKit                         	0x334a348a 0x333f3000 + 722058
Jun 26 08:56:11 Neptune ReportCrash[891] <Error>: 34  EventKitUI                    	0x362505a2 0x3622e000 + 140706

...

I'll have a look into it - but right now I think you assume [1] a condition that is not true (and not even ready to be evaluated at this stage) on old iOS releases.

Accessing `controller.ViewControllers[0]` is fine, just not the View. Note that accessing `view` is technically correct (API wise) but it has a side effect of calling `loadView` [2] if the view is null - and I suspect iOS is not ready yet to load it.

[1] controller.ViewControllers[0].View is UITableView
[2] http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html

p.s. I do not have VS so please file a separate bug report for it (in any case one bug per report, otherwise confusion ensure only one, at best, gets fixed :-)
Comment 3 Sebastien Pouliot 2013-06-26 09:31:52 UTC
So the issue is that you're not following a EKEventEditViewController requirement [1] wrt the the `eventStore` property:

<quote>This property must be set before displaying the view.</quote>

And it turns out to be important, for initialization, under iOS 5.1 while it may not be on iOS6.

Adding:

	controller.EventStore = new EKEventStore ();

before accessing the `view` solve the crash on my iPad1.

[1] http://developer.apple.com/library/ios/#documentation/EventKitUI/Reference/EKEventEditViewControllerClassRef/Reference/Reference.html
Comment 4 John Hair 2013-06-26 10:04:55 UTC
Thank you Sebastien!
Completely missed that in the comments on the properties. I was actually setting the properties later, but before actually displaying the view.

Looks good, I can keep this functionality available to my iOS 5 users.

Cheers
John