Bug 53656 - Crash in DatePicker
Summary: Crash in DatePicker
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.3
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
Depends on:
Reported: 2017-03-21 13:09 UTC by Gert Jan Schoneveld
Modified: 2018-05-20 16:27 UTC (History)
4 users (show)

Tags: crash, android, datepicker, ac
Is this bug a regression?: ---
Last known good build:

repro project (292.54 KB, application/x-zip-compressed)
2017-03-21 22:12 UTC, Jimmy [MSFT]

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 for Bug 53656 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Gert Jan Schoneveld 2017-03-21 13:09:00 UTC
Put a DatePicker in your form.

If you tap twice fast enough the dialog is opened twice.

If you press OK in the second dialog, the app crashes with a System.NullReferenceException.

Forms Happens on phone with Android 6.0. Doesn't happen on tablet with Android 4.4.2.

  at Xamarin.Forms.Platform.Android.DatePickerRenderer+<>c__DisplayClass9_0.<CreateDatePickerDialog>b__0 (System.Object o, Android.App.DatePickerDialog+DateSetEventArgs e) [0x0003e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Renderers\DatePickerRenderer.cs:113 
  at Android.App.DatePickerDialog+IOnDateSetListenerImplementor.OnDateSet (Android.Widget.DatePicker view, System.Int32 year, System.Int32 month, System.Int32 dayOfMonth) [0x0000d] in /Users/builder/data/lanes/4009/3a62f1ea/source/monodroid/src/Mono.Android/platforms/android-25/src/generated/Android.App.DatePickerDialog.cs:149 
  at Android.App.DatePickerDialog+IOnDateSetListenerInvoker.n_OnDateSet_Landroid_widget_DatePicker_III (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_view, System.Int32 year, System.Int32 month, System.Int32 dayOfMonth) [0x00011] in /Users/builder/data/lanes/4009/3a62f1ea/source/monodroid/src/Mono.Android/platforms/android-25/src/generated/Android.App.DatePickerDialog.cs:86 
  at (wrapper dynamic-method) System.Object:9f7dfda6-fb1e-4732-8263-c068d533e785 (intptr,intptr,intptr,int,int,int)
Comment 1 Jimmy [MSFT] 2017-03-21 14:44:07 UTC
Thank you for filing this report! Let me test this with a sample project to see if I can reproduce and confirm this issue. I will update the report with my results.
Comment 2 Jimmy [MSFT] 2017-03-21 22:12:11 UTC
Created attachment 20540 [details]
repro project

I am able to reproduce this crash with the project I am attaching. The crash is occurring at this line[1] which is why it is only occurring on API 21+. I am confirming this report so the team can investigate further. 

Full debug output: https://gist.github.com/jimmgarrido/31db7f4bfc64cb6ff5311f4367de8d1d

### Steps to Reproduce
1. Run the attached Android project on Lollipop or higher
2. Quickly tap on the DatePicker twice. This was easier on an actual device than emulator.
3. In the date picker, press "Okay"
4. Press "Okay" again on the second picker dialog

### Expected Results
The second picker will close. Ideally though, double tapping the Picker control should not open to pickers.

### Actual Results
The app will crash.

### Version Tests
2.3.4-pre5  BAD   BAD

[1] https://github.com/xamarin/Xamarin.Forms/blob/2.3.3/Xamarin.Forms.Platform.Android/Renderers/DatePickerRenderer.cs#L113
Comment 3 Jason Smith [MSFT] 2017-06-19 20:59:03 UTC
Just need simple double tap protection
Comment 4 Mikalai Daronin 2018-05-06 07:06:43 UTC
What is the status of the issue?