Skip to content

Commit c79b153

Browse files
authored
Merge pull request #1322 from Unity-Technologies/unity-master-fix-xb1-timezone
The fix for 1256569 broke a test. Partial revert
2 parents da7ba37 + a54323f commit c79b153

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

mcs/class/corlib/System/TimeZoneInfo.WinRT.cs

+11
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,17 @@ internal static List<TimeZoneInfo> GetSystemTimeZonesWinRTFallback ()
359359
// EnumDynamicTimeZoneInformation() might not be available.
360360
}
361361

362+
// If we are in this function we know that TimeZoneKey is null and need to use the fallback
363+
// Adding Local here will cause a stack overflow
364+
if (result.Count == 0)
365+
{
366+
var l = GetLocalTimeZoneInfoWinRTFallback();
367+
if (Interlocked.CompareExchange (ref local, l, null) != null)
368+
l = local;
369+
370+
result.Add(l);
371+
}
372+
362373
return result;
363374
}
364375
}

mcs/class/corlib/System/TimeZoneInfo.cs

-4
Original file line numberDiff line numberDiff line change
@@ -787,10 +787,6 @@ public static ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones ()
787787
if (systemTimeZones == null) {
788788
var tz = new List<TimeZoneInfo> ();
789789
GetSystemTimeZonesCore (tz);
790-
// Don't want to return an empty list if we can help it
791-
// but we don't want to stack overflow via a CreateLocal loop
792-
if (tz.Count == 0 && local != null)
793-
tz.Add(Local);
794790
Interlocked.CompareExchange (ref systemTimeZones, new ReadOnlyCollection<TimeZoneInfo> (tz), null);
795791
}
796792

0 commit comments

Comments
 (0)