Skip to content

Commit

Permalink
TimeZoneInfo.Local must be cached, otherwise reference comparisons fa…
Browse files Browse the repository at this point in the history
…il later on.

This fixes an issue reported here: http://lists.ximian.com/pipermail/monotouch/2012-September/011784.html
  • Loading branch information
rolfbjarne committed Sep 17, 2012
1 parent 09e213a commit 142e70f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mcs/class/System.Core/System/TimeZoneInfo.cs
Expand Up @@ -89,7 +89,7 @@ public sealed partial class TimeZoneInfo : IEquatable<TimeZoneInfo>, ISerializab
local = ZoneInfoDB.Default;
#elif MONOTOUCH
using (Stream stream = GetMonoTouchDefault ()) {
return BuildFromStream ("Local", stream);
local = BuildFromStream ("Local", stream);
}
#elif LIBC
try {
Expand Down
9 changes: 9 additions & 0 deletions mcs/class/System.Core/Test/System/TimeZoneInfoTest.cs
Expand Up @@ -384,6 +384,15 @@ public void ConvertFromToUtc ()
Assert.AreEqual (utc, back);

}

[Test]
public void ConvertToTimeZone ()
{
if (Environment.OSVersion.Platform != PlatformID.Unix)
return;

TimeZoneInfo.ConvertTime (DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Pacific/Auckland"));
}
}

[TestFixture]
Expand Down

0 comments on commit 142e70f

Please sign in to comment.