提交 7d3af3b2 编写于 作者: U UnityAlex 提交者: Dharmendra Tomar

The fix for 1256569 broke a test. Reverting most of that change and breaking...

The fix for 1256569 broke a test. Reverting most of that change and breaking the CreateLocal -> WinRTFallback -> CreateLocal loop by calling GetLocalTimeZoneInfoWinRTFallback instead of accessing Local from within FindSystemTimeZoneByIdWinRTFallback fixes both issues.

Need to make sure we don't duplicate the timezone and create a new local when we already have one.
上级 c4090389
......@@ -359,6 +359,17 @@ namespace System
// 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;
}
}
......
......@@ -787,10 +787,6 @@ namespace System
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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册