[Android] Filter UTC aliases from GetSystemTimeZones to avoid duplicate display names - #121964
[Android] Filter UTC aliases from GetSystemTimeZones to avoid duplicate display names#121964simonrozsival with Copilot wants to merge 2 commits into
Conversation
… names Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
| // Skip UTC aliases to avoid duplicate display names in the list. | ||
| // UTC is already added to the dictionary at the start, and aliases like | ||
| // UCT, Etc/UTC, Zulu, etc. have the same display name as UTC. | ||
| if (IsUtcAlias(timeZoneId)) |
There was a problem hiding this comment.
IsUtcAlias can also be simplified:
private static bool IsUtcAlias(string id) => id[0] switch
{
'e' or 'E' => string.Equals(id, "Etc/UTC", StringComparison.OrdinalIgnoreCase) ||
string.Equals(id, "Etc/UCT", StringComparison.OrdinalIgnoreCase) ||
string.Equals(id, "Etc/Universal", StringComparison.OrdinalIgnoreCase) ||
string.Equals(id, "Etc/Zulu", StringComparison.OrdinalIgnoreCase),
'u' or 'U' => string.Equals(id, "UCT", StringComparison.OrdinalIgnoreCase) ||
string.Equals(id, "UTC", StringComparison.OrdinalIgnoreCase) ||
string.Equals(id, "Universal", StringComparison.OrdinalIgnoreCase),
'z' or 'Z' => string.Equals(id, "Zulu", StringComparison.OrdinalIgnoreCase),
_ => false
};
It is unrelated? |
Yes, copilot got it wrong. Edited. |
|
I don't think this is the right fix. We have the issue #90269 tracking ensuring not returning any duplicates on Android. When this issue get fixed should include UTC alias duplicate too. The change in this PR will add extra overhead for other platforms which is not necessary. I would say disable the failing test on Android for now. |
|
Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger |
|
@simonrozsival could you please ensure disabling the failing test for Android platform then close #121963 to avoid skipping failures on other platforms? Thanks! |
|
@tarekgh yes, I will disable the test tomorrow |
TimeZoneInfoTests.TestGetSystemTimeZonesfails on Android becauseGetSystemTimeZones()returns UTC aliases (UCT, Etc/UTC, Zulu, etc.) alongside UTC, all sharing the same display name "(UTC) Coordinated Universal Time".Changes
PopulateAllSystemTimeZonesusing existingIsUtcAlias()checkFixes #121963
Original prompt
System.Tests.TimeZoneInfoTests.TestGetSystemTimeZonesfailure: Assert.DoesNotContain #121963✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.