[Mono-bugs] [Bug 619811] New: TimeZoneInfo.ConvertTimeFromUtc throws a NullReferenceException for US/Hawaii timezone
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun Jul 4 21:04:10 EDT 2010
http://bugzilla.novell.com/show_bug.cgi?id=619811
http://bugzilla.novell.com/show_bug.cgi?id=619811#c0
Summary: TimeZoneInfo.ConvertTimeFromUtc throws a
NullReferenceException for US/Hawaii timezone
Classification: Mono
Product: Mono: Class Libraries
Version: 2.4.x
Platform: 64bit
OS/Version: UNIX Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: graham.wagener at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.86 Safari/533.4
I get the following exception and truncated stack trace when calling
ConvertTimeFromUtc with destinationTimeZone of "US/Hawaii".
TimeZoneInfo hawaiiTZI = TimeZoneInfo.FindSystemTimeZoneById("US/Hawaii");
DateTime gmt = new DateTime(...);
DateTime local = TimeZoneInfo(gmt, hawaiiTZI);
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
at System.TimeZoneInfo.GetApplicableRule (DateTime dateTime) [0x00000]
at System.TimeZoneInfo.ConvertTimeFromUtc (DateTime dateTime) [0x00000]
at System.TimeZoneInfo.ConvertTimeFromUtc (DateTime dateTime,
System.TimeZoneInfo destinationTimeZone) [0x00000]
Hawaii does not observe Daylight Savings Time so hawaiiTZI.GetAdjustmentRules()
returns an empty array or possibly null, which presumably leads to the NRE in
GetApplicableRule.
A workaround and example of related code that does work is using GetUtcOffset.
On Windows under .NET the following returns the same value as
ConvertTimeFromUtc and does not throw an exception in mono:
DateTime local = gmt + hawaiiTZI.GetUtcOffset(gmt);
Reproducible: Always
Steps to Reproduce:
see code in description
Actual Results:
exception
Expected Results:
no exception
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list