Bugzilla – Bug 621408
TimeZoneInfo.FindSystemTimeZoneById(TimeZoneInfo.Local.Id) throws a TimeZoneNotFoundException
Last modified: 2010-08-19 10:43:21 UTC
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4 When trying to find a TimeZoneInfo by Id, you can't use the local TimeZoneInfo's Id. TimeZoneInfo.Local.Id results in "Local" "Local" is not a valid Id for any TimeZoneInfo in TimeZoneInfo.GetSystemTimeZones() Reproducible: Always Steps to Reproduce: 1. $> csharp 2. TimeZoneInfo.FindSystemTimeZoneById(TimeZoneInfo.Local.Id); Actual Results: System.TimeZoneNotFoundException: Exception of type 'System.TimeZoneNotFoundException' was thrown. at System.TimeZoneInfo.FindSystemTimeZoneByFileName (System.String id, System.String filepath) [0x00000] in <filename unknown>:0 at System.TimeZoneInfo.FindSystemTimeZoneById (System.String id) [0x00000] in <filename unknown>:0 at Class6.Host (System.Object& $retval) [0x00000] in <filename unknown>:0 at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result, System.Boolean& result_set) [0x00000] in <filename unknown>:0 at Mono.CSharpShell.Evaluate (System.String input) [0x00000] in <filename unknown>:0 Expected Results: A TimeZoneInfo representing the current time zone should be returned. $> mono --version Mono JIT compiler version 2.6.7 (tarball Thu Jul 8 20:11:11 UTC 2010) Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com TLS: __thread GC: Included Boehm (with typed GC and Parallel Mark) SIGSEGV: altstack Notifications: epoll Architecture: x86 Disabled: none
I forgot to mention that I did try this on MS .NET and it worked as intended.