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)

Tags:
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 GitHub or Developer Community 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:
Status:
RESOLVED FIXED

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