Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 13266 [details]
Jan 17 was selected in UIDatePicker, but querying it in the immediate window returns Nov 17
I have a UIDatePicker that is presented to the user as a UITextField's InputView. The same UITextField also has an InputAccessoryView that is a toolbar with the buttons Cancel and Done. When the user taps on the UITextField, the UIDatePicker is presented, allowing the user to select a date and then they can press the Done button. This causes the UITextField's text to be updated with the selected date.
This appears to work fine, but every once in a while, the user may select a new date press return, but the UITextField is still showing the previous date. When I examined this in the debugger, what I found was that even though the UIDatePicker was visibly showing the new date, when the code queries the UIDatePicker.Date property, it is returning a different (previous) date. I've attached a screenshot that shows this (Jan 17 was selected in the UIDatePicker, the Done button was pressed, triggering my breakpoint, and when I query the UIDatePicker in the immediate window, it returns Nov 17 2015).
I haven't found an easy way to repro this, as it appears to happen somewhat randomly.
We're just a thin wrapper around the iOS API, so I'm not quite sure this is really a bug in Xamarin.iOS (as opposed to a bug in iOS or even your own code).
We can look at it, but we'd really need some sort of test case to reproduce it ourselves.
Although there are a few questions that might narrow it down:
* Does it happen on simulator only, or on device as well?
* Does it happen on older versions of iOS as well?
* Can you reproduce the same behavior with a different UI layout? Trying to make things simpler is usually a great way to find out exactly where the problem is.
Thanks Rolf, that's what I thought. I've only tested for it on the simulator. Unfortunately it's hard to repro, I've not found a consistent pattern in its behavior. Was hoping that might have triggered an "aha" on your end.
One thing I noticed is that you're ensuring you're on the main thread. Is the value still wrong if you print it out inside the "Done" button event handler itself?
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!