Bug 11264 - TimeZoneNotFoundException calling TimeZoneInfo.Local.GetUtcOffset(dateTime)
Summary: TimeZoneNotFoundException calling TimeZoneInfo.Local.GetUtcOffset(dateTime)
Status: RESOLVED DUPLICATE of bug 11817
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Core (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-03-19 11:39 UTC by DesDesDes
Modified: 2018-03-13 14:02 UTC (History)
5 users (show)

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


Attachments
System.TimeZoneNotFoundException (1.12 KB, patch)
2016-08-04 22:57 UTC, rekaheno
Details


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 DUPLICATE of bug 11817

Description DesDesDes 2013-03-19 11:39:54 UTC
Repro on Windows 7 using mono 3.0.6.

Following test fails on Windows 7 using mono 3.0.6, but succeeds using MS.NET 3.5

[TestFixture()]
public class Test
{
	[Test()]
	public void TestCase ()
	{
		var d = new DateTime(2013, 12, 1);
		var offset = TimeZoneInfo.Local.GetUtcOffset(d);
		var baseOffset = TimeZoneInfo.Local.BaseUtcOffset;
		Assert.AreEqual(baseOffset, offset);
	}
}

System.TimeZoneNotFoundException : Exception of type 'System.TimeZoneNotFoundException' was thrown.
  at System.TimeZoneInfo.get_Local () [0x00000] in <filename unknown>:0
  at Test.Test.TestCase () [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

This also prevents the commonly used Newtonsoft.Json library from serializing DateTime values to .net objects.
Comment 1 Andrey 2013-04-17 05:49:39 UTC
Looks like the same as https://bugzilla.xamarin.com/show_bug.cgi?id=11817
Comment 2 rekaheno 2016-08-04 22:57:40 UTC
Created attachment 16908 [details]
System.TimeZoneNotFoundException
Comment 3 Marek Safar 2018-03-13 14:02:22 UTC

*** This bug has been marked as a duplicate of bug 11817 ***