A private overload of the public GetSystemTimeZones() method was added in
4dc9a90d7f23f0f5a7a31f7357ea782408d3d9b5.
This broke code that tried to access that method via reflection and expected that there be only one.
Fixing this by renaming the private method to GetSystemTimeZonesCore (which is also more aligned with FindSystemTimeZoneByIdCore).
return timeZoneInfo;
}
- static void GetSystemTimeZones (List<TimeZoneInfo> systemTimeZones)
+ static void GetSystemTimeZonesCore (List<TimeZoneInfo> systemTimeZones)
{
foreach (string id in AndroidTimeZones.GetAvailableIds ()) {
var tz = AndroidTimeZones.GetTimeZone (id, id);
}
}
- static void GetSystemTimeZones (List<TimeZoneInfo> systemTimeZones)
+ static void GetSystemTimeZonesCore (List<TimeZoneInfo> systemTimeZones)
{
foreach (string name in GetMonoTouchNames ()) {
using (Stream stream = GetMonoTouchData (name, false)) {
#endif
}
- static void GetSystemTimeZones (List<TimeZoneInfo> systemTimeZones)
+ static void GetSystemTimeZonesCore (List<TimeZoneInfo> systemTimeZones)
{
#if !MOBILE_STATIC
if (TimeZoneKey != null) {
{
if (systemTimeZones == null) {
var tz = new List<TimeZoneInfo> ();
- GetSystemTimeZones (tz);
+ GetSystemTimeZonesCore (tz);
Interlocked.CompareExchange (ref systemTimeZones, new ReadOnlyCollection<TimeZoneInfo> (tz), null);
}
}
Assert.Fail ("Europe/Brussels not found in SystemTZ");
}
+
+ [Test]
+ public void ReflectionReturnsTheCorrectMethod ()
+ {
+ var method = (MethodInfo) typeof (TimeZoneInfo).GetMember ("GetSystemTimeZones", MemberTypes.Method, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)[0];
+
+ var timeZones = (global::System.Collections.ObjectModel.ReadOnlyCollection<TimeZoneInfo>) method.Invoke (null, null);
+ Assert.IsNotEmpty (timeZones);
+ }
}
[TestFixture]