Bug 37853 - DatePicker crashes on tap if Date is changed when not in focus
Summary: DatePicker crashes on tap if Date is changed when not in focus
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.0.0
Hardware: Other Other
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-01-20 21:49 UTC by kanderson
Modified: 2017-06-20 12:24 UTC (History)
3 users (show)

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

a simple app to recreate the crash. follow the steps in bug description. i had to remove the packages to fit the size requirements, I hope this doesn't make it too difficult to run. (301.70 KB, application/x-zip-compressed)
2016-01-20 21:53 UTC, kanderson

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 kanderson 2016-01-20 21:49:54 UTC
You can cause a crash on iOS if you change the DatePicker’s Date when the DatePicker isn’t in focus, and then try to refocus the DatePicker. A very simple app you can use to recreate the crash is attached. To recreate the crash, do this:
1) Tap the DatePicker to open it
2) Turn one of the knobs to mess with the date
3) Tap that Entry sitting there
4) Tap the “Reset Date” button
5) Tap the DatePicker again

The exception you get is:
Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: UITableView dataSource is not set

This bug sounds hilariously similar to a bug Cordova has with their DatePicker.
Comment 1 kanderson 2016-01-20 21:53:13 UTC
Created attachment 14645 [details]
a simple app to recreate the crash. follow the steps in bug description. i had to remove the packages to fit the size requirements, I hope this doesn't make it too difficult to run.
Comment 2 Stephane Delcroix 2016-01-21 15:33:21 UTC

I tried to reproduce your issue on both iPhone simulator and actual iPhone but the app doesn't crash for me.

Can you give us more info on what device, OS version, locale you use to reproduce this crash ?

What seems strange to me is the `UITableView` message, as your app doesn't use any table views...

Warm regards,

the xf team
Comment 3 kanderson 2016-01-21 15:44:48 UTC
Hi Stephane,

Perhaps I should have mentioned this in my original post - when you are trying to recreate the crash, do not press any "Done" buttons. Just tap exactly as I described with no other interaction that what I described. Be sure you are also turning a date wheel and allowing enough time for the change to appear in the DatePicker's 'Entry' display thing.

I just downloaded and ran my attachment directly to be sure I uploaded the right zip and it is the right one, showing the crash on the first run.

I'm seeing it on an iPhone 6 running iOS 9.2, not jail-broken if that matters. What sort of answer would be appropriate for "locale"? 

For building, I'm using VS 2013 in Windows 7, connected to a Mac Mini running Xcode 7.2 in OS X 10.10.5
Comment 4 kanderson 2016-01-21 20:00:54 UTC
These also cause a crash:
1) Tap the datepicker
2) Turn one of the knobs to change the date (be sure to allow time for the datepicker entryish display to refresh)
3) Tap Done for the open datepicker roller window
4) Tap the "Reset" button
5) Tap the Entry
6) Tap the datepicker

The application doesn't crash, if this additional step is added between (5) and (6):
5.5. Tap somewhere outside the entry, so the keyboard is closed.
Comment 5 Stephane Delcroix 2016-01-21 21:04:10 UTC

I tried to reproduce your issue just as you said, by following the steps, on an iphone6 running iOS 9.3

By locale, I mean what's your phone language and what are your regional settings ?
Comment 6 kanderson 2016-01-21 21:33:26 UTC
FYI I am also able to make it happen using a 6+ running iOS 9.2.1.

Phone language English... central time... bought from a legitimate store in Minnesota... Very much default U.S. settings as far as I know...

So you're not able to reproduce the crash with either of the procedures I listed?
Comment 9 Samantha Houts [MSFT] 2017-06-19 22:25:23 UTC
Unfortunately, we’re unable to reproduce this report. If this issue is still occurring for you, please reopen this issue and attach a reproduction to the bug by starting with a clean Xamarin.Forms project adding just the code necessary to demonstrate the issue. 
Here are some reproduction best practices: https://gist.github.com/jassmith/92405c300e54a01dcc6d