Bug 43512

Summary: TimeZoneInfo.ConvertTimeBySystemTimeZoneId ArgumentException
Product: [Mono] Class Libraries Reporter: Chris Hamons <chris.hamons>
Component: SystemAssignee: Marek Safar <masafa>
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: unspecified   
Target Milestone: Untriaged   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

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
	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