Bug 11264 - TimeZoneNotFoundException calling TimeZoneInfo.Local.GetUtcOffset(dateTime)
Summary: TimeZoneNotFoundException calling TimeZoneInfo.Local.GetUtcOffset(dateTime)
Status: NEW
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: 2016-08-04 22:57 UTC (History)
4 users (show)

See Also:
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 | Diff

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

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