This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 43512 - TimeZoneInfo.ConvertTimeBySystemTimeZoneId ArgumentException
Summary: TimeZoneInfo.ConvertTimeBySystemTimeZoneId ArgumentException
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-08-18 14:19 UTC by Chris Hamons
Modified: 2016-08-20 09:15 UTC (History)
1 user (show)

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


Attachments

Description Chris Hamons 2016-08-18 14:19:10 UTC
The following code was provided by a customer:

	DateTime localTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.Utc, TimeZoneInfo.Local);
	DateTime localTime2 = TimeZoneInfo.ConvertTimeBySystemTimeZoneId (DateTime.UtcNow, TimeZoneInfo.Utc.Id, TimeZoneInfo.Local.Id);

	Console.WriteLine (localTime.ToShortDateString ());

The call to ConvertTimeBySystemTimeZoneId with throw an ArgumentException with the following text:

	Kind property of dateTime is Utc but the sourceTimeZone does not equal TimeZoneInfo.Utc

Reproduced in a simple .NET console application with:

Xamarin Studio Business
Version 6.1 (build 4373)
Installation UUID: d2217398-f397-4dfc-85c1-f94f9fab852d
Runtime:
	Mono 4.7.0 (master/c340568) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 407000252
Comment 1 Chris Hamons 2016-08-18 14:19:48 UTC
@Marek - Git log suggested you might be a good fit. Ping me on slack if you have an questions.
Comment 2 Marek Safar 2016-08-20 09:15:04 UTC
Fixed in master and Mono 4.6

Note You need to log in before you can comment on or make changes to this bug.