Skip to content

Conversation

@tarekgh
Copy link
Member

@tarekgh tarekgh commented Aug 6, 2024

In .NET 8.0 we have done some optimization work to delay initializing the time zone names (Standard, Daylight, and Display names). The reason is the names initialization is extremely expensive especially on non-Windows OS's because we do some heuristics and call ICU to extract such names. Unintentionally doing names lazy initialization on non-Windows OS's caused a problem with the time zones created using Windows Ids e.g. Eastern Standard Time. The reason is to get the correct names of the time zone you need to call ICU using the IANA ids e.g. America/New_York which not done with the lazy initialization. The fix here is to ensure using the IANA ids on non-Windows OS's when requesting the names from ICU.

The repro of the issue, on Linux use code like:

TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
Console.WriteLine($"{zoneName}: {timeZone.Id} ... {timeZone.StandardName} ... {timeZone.DaylightName} ");

This code will display names like GMT which are wrong as expected to show something like Eastern Standard Time: Eastern Standard Time ... Eastern Standard Time ... Eastern Daylight Time.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-datetime
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@mdh1418 mdh1418 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

@tarekgh
Copy link
Member Author

tarekgh commented Aug 6, 2024

/backport to 8.0-staging

@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2024

Started backporting to 8.0-staging: https://github.com/dotnet/runtime/actions/runs/10275576890

@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2024

@tarekgh an error occurred while backporting to 8.0-staging, please check the run log for details!

The process '/usr/bin/git' failed with exit code 1

@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants