Bug 44893 - Previewer Android mode cannot display DatePicker
Summary: Previewer Android mode cannot display DatePicker
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Xamarin.Forms Previewer ()
Version: 4.2.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: 4.3.0 (C9)
Assignee: Jérémie Laval
URL:
: 51132 51699 51725 ()
Depends on:
Blocks:
 
Reported: 2016-09-29 16:30 UTC by xamarinbugzilla
Modified: 2017-01-27 09:01 UTC (History)
7 users (show)

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


Attachments
logs (90.57 KB, application/x-zip-compressed)
2016-10-07 02:28 UTC, Kyle White
Details
VSLogs_machine1 (911.46 KB, application/x-zip-compressed)
2017-01-12 12:59 UTC, Prashant manu
Details
VSLogs_machine2 (969.85 KB, application/x-zip-compressed)
2017-01-12 13:02 UTC, Prashant manu
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 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:
VERIFIED FIXED

Description xamarinbugzilla 2016-09-29 16:30:27 UTC
I created a blank phone ContentPage then add a date picker in a stack layout to it like:

  <StackLayout VerticalOptions="Center" HorizontalOptions="Center">
    <DatePicker></DatePicker>
  </StackLayout>

Setting the preview to iOS mode - I see a date picker with today's date - setting the preview to "Android" gives me exceptions.
Comment 1 xamarinbugzilla 2016-09-29 17:14:15 UTC
It doesn't display a TimePicker either. It displays :'(
Comment 2 Kyle White 2016-10-07 02:28:44 UTC
Created attachment 17922 [details]
logs

Able to reproduce in recent master so I'll confirm the bug. 

Neither DatePicker or TimePicker work in the Android preview, but do work for iOS (as mentioned above).

	<StackLayout VerticalOptions="Center" HorizontalOptions="Center">
		<DatePicker></DatePicker>
		<TimePicker></TimePicker>
	</StackLayout>


Xamarin   4.3.0.7 (3f35621)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.99.118 (736438a)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.1.0.135 (0760023)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 3 Kyle White 2016-10-07 14:11:06 UTC
Moving to C9 milestone to track for stable release of this feature.
Comment 4 Dominique Louis 2016-10-25 16:49:13 UTC
DatePicker and TimePicker controls are not currently supported for previewing under Android. They are supported under iOS. We are awaiting an appropriate fix from the Forms Team for this to work under Android when previewing.
Comment 5 Alan McGovern 2016-11-03 10:33:07 UTC
The error here is:
ERROR [2016-11-03 10:26:27Z]: The renderer encountered an error while rendering this file: System.InvalidOperationException: You MUST call Xamarin.Forms.Init(); prior to using it.
at Xamarin.Forms.Device.get_Info () in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\Device.cs:25
at Xamarin.Forms.Platform.Android.DatePickerRenderer..ctor () in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Renderers\DatePickerRenderer.cs:21
at <unknown method> at offset 12 in file:line:column <filename unknown>:0:0
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) in /Users/builder/data/lanes/1196/37a070c0/source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:661
Comment 6 Alan McGovern 2016-11-03 10:34:23 UTC
PR: https://github.com/xamarin/Xamarin.Forms/pull/503
Comment 7 Alan McGovern 2016-11-03 11:14:37 UTC
(probably) better PR: https://github.com/xamarin/Xamarin.Forms/pull/504
Comment 8 Alan McGovern 2016-11-18 11:14:30 UTC
This is resolved and will require a new Xamarin.Forms release. I believe it will be included in the 2.3.4 release series.
Comment 9 Alan McGovern 2017-01-03 12:15:47 UTC
*** Bug 51132 has been marked as a duplicate of this bug. ***
Comment 14 Alan McGovern 2017-01-12 16:25:24 UTC
Jeremie, can i leave this one with you?
Comment 15 Alan McGovern 2017-01-13 10:53:22 UTC
Jeremie patched XS (to work around an x.a desktop limitation) and xamarin-android (to fix a broken p/invoke):

XS:
https://github.com/xamarin/md-addins/commit/6a97d45439359580b265f499d520cacccf3035a1

xamarin.android:
https://github.com/xamarin/xamarin-android/commit/57433275e62b2216830916d52301c905ded09995
https://github.com/xamarin/xamarin-android/commit/ad615c6e334540ee12f2cde2511a2b4f3513957d

Once these commits are backported to the relevant C9 branches it will *probably* work.
Comment 16 Alan McGovern 2017-01-24 14:28:01 UTC
*** Bug 51725 has been marked as a duplicate of this bug. ***
Comment 17 Alan McGovern 2017-01-24 14:32:14 UTC
*** Bug 51699 has been marked as a duplicate of this bug. ***
Comment 18 Jérémie Laval 2017-01-25 19:13:28 UTC
This is should now be fixed across the board in C9 (both XS / XVS).