Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mcs/class/corlib/System/TimeZoneInfo.WinRT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,17 @@ internal static List<TimeZoneInfo> GetSystemTimeZonesWinRTFallback ()
// EnumDynamicTimeZoneInformation() might not be available.
}

// If we are in this function we know that TimeZoneKey is null and need to use the fallback
// Adding Local here will cause a stack overflow
if (result.Count == 0)
{
var l = GetLocalTimeZoneInfoWinRTFallback();
if (Interlocked.CompareExchange (ref local, l, null) != null)
l = local;

result.Add(l);
}

return result;
}
}
Expand Down
4 changes: 0 additions & 4 deletions mcs/class/corlib/System/TimeZoneInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -787,10 +787,6 @@ public static ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones ()
if (systemTimeZones == null) {
var tz = new List<TimeZoneInfo> ();
GetSystemTimeZonesCore (tz);
// Don't want to return an empty list if we can help it
// but we don't want to stack overflow via a CreateLocal loop
if (tz.Count == 0 && local != null)
tz.Add(Local);
Interlocked.CompareExchange (ref systemTimeZones, new ReadOnlyCollection<TimeZoneInfo> (tz), null);
}

Expand Down