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.
I have a Xamarin.iOS unified app. I pull objects with DateTime from a REST service.
These DateTime are UTC. For display, I convert them to local time using ToLocalTime() (I am in CET time zone), so far so good.
Now when I don't link the project (iOS Build -> Linker Options -> Don't link), everything is working fine.
When I link the project (iOS Build -> Linker Options -> Link SDK assemblies only), ToLocalTime() is wrong.
iOS SDK version used is 8.2.
The linker does not change anything about the dates/time zones. This code runs identically with or without the linker enabled (EST time zone).
public void D ()
var x = DateTime.UtcNow;
var y = x.ToLocalTime ();
2015-04-01 15:44:08.509 linkall[17199:19531250] 4/1/2015 7:44:08 PM
2015-04-01 15:44:09.980 linkall[17199:19531250] 4/1/2015 3:44:08 PM
2015-04-01 15:45:12.190 linkall[17228:19537035] 4/1/2015 7:45:11 PM
2015-04-01 15:45:13.331 linkall[17228:19537035] 4/1/2015 3:45:11 PM
However REST services are generally used with serialization and that might need some extra care (reflection being used) to ensure unused code is not removed. I strongly suspect the issue exists before the conversion to local time.
Is it possible to provide a test case ?
You can also try to print the date (e.g. `dt.Ticks`) before and after the conversion (ToLocalTime). My guess is that the conversion is correct but the original value (deserialized from the REST response) is different.
Yes, it's definitely an issue from the way we deserialize the DateTime from the REST service.
I close this one, it's not relevant.