Bug 661542

Summary: TimeZoneInfo.ConvertTime() throws NullReferenceException
Product: [Mono] Mono: Class Libraries Reporter: Christian Mueller <post-christian>
Component: Sys.CoreAssignee: Mono Bugs <mono-bugs>
Status: NEW --- QA Contact: Mono Bugs <mono-bugs>
Severity: Normal    
Priority: P5 - None CC: post-christian
Version: 2.8.x   
Target Milestone: ---   
Hardware: x86-64   
OS: openSUSE 11.0   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

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