Bug 34549 - Setting a BindableProperty of Type DateTime? to null raises Error
Summary: Setting a BindableProperty of Type DateTime? to null raises Error
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.5.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Stephane Delcroix
Depends on:
Reported: 2015-10-04 11:42 UTC by martin
Modified: 2015-10-23 10:23 UTC (History)
6 users (show)

Tags: AC
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:

Description martin 2015-10-04 11:42:42 UTC
public static BindableProperty DateProperty =
        BindableProperty.Create<ClassName, DateTime?>(o => o.Date, null, BindingMode.TwoWay, null, OnDateChanged);

        public DateTime? Date
            get { return (DateTime?)GetValue(DateProperty); }
                DateTime? tmp = value;
                SetValue(DateProperty, tmp);

Setting it in the code like 'Date = null;' raises the following error:
SetValue: Can not convert  to type 'System.Nullable`1[System.DateTime]'
[0:] SetValue: Can not convert  to type 'System.Nullable`1[System.DateTime]'
10-04 17:20:34.132 I/mono-stdout( 5246): SetValue: Can not convert  to type 'System.Nullable`1[System.DateTime]'
10-04 17:20:34.136 I/Choreographer( 5246): Skipped 285 frames!  The application may be doing too much work on its main thread.

It can be null at the beginning, but as soon as it has once a Value i can not reset it to null.

Thank you for your help.
Comment 1 Rui Marinho 2015-10-08 07:23:36 UTC
Should be fixed in 1.5.2-pre1