Bug 661542 - TimeZoneInfo.ConvertTime() throws NullReferenceException
Summary: TimeZoneInfo.ConvertTime() throws NullReferenceException
Status: NEW
Alias: None
Product: Mono: Class Libraries
Classification: Mono
Component: Sys.Core (show other bugs)
Version: 2.8.x
Hardware: x86-64 openSUSE 11.0
: P5 - None : Normal
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-27 22:07 UTC by Christian Mueller
Modified: 2010-12-27 22:07 UTC (History)
1 user (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Mueller 2010-12-27 22:07:51 UTC
Description of Problem:

converting times between some (not all) time zones is throwing an exception.

Steps to reproduce the problem:

the following code reproduces the problem

DateTime dt = new DateTime( 2000, 1, 1, 0, 0, 0, DateTimeKind.Utc );
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById( "Pacific/Nauru" );
dt = TimeZoneInfo.ConvertTimeFromUtc( dt, tzi );
Console.WriteLine( dt.ToString( "R" ) );
TimeZoneInfo tzi2 = TimeZoneInfo.FindSystemTimeZoneById( "Pacific/Chatham" );
dt = TimeZoneInfo.ConvertTime( dt, tzi, tzi2 );
Console.WriteLine( dt.ToString( "R" ) );

Actual Results:

Sat, 01 Jan 2000 12:00:00 GMT

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at System.TimeZoneInfo.IsInvalidTime (DateTime dateTime) [0x00029] in /root/install/mono-2.8.1/mcs/class/System.Core/System/TimeZoneInfo.cs:660
  at System.TimeZoneInfo.ConvertTime (DateTime dateTime, System.TimeZoneInfo sourceTimeZone, System.TimeZoneInfo destinationTimeZone) [0x00046] in /root/install/mono-2.8.1/mcs/class/System.Core/System/TimeZoneInfo.cs:177
  at PHPS.Test.Run (PHPS.State state) [0x00041] in /home/christian/Windows/D/Projekte/c#/PHPS/console/source/Program.cs:54
  at PHPS.Program.Main (System.String[] args) [0x00c1e] in /home/christian/Windows/D/Projekte/c#/PHPS/console/source/Program.cs:354

Expected Results:

a valid time

How often does this happen? 

every time