Skip to content

[release/6.0] Fix TimeZoneInfo.HasIanaId when using Local Time Zone#58414

Merged
Anipik merged 1 commit into
dotnet:release/6.0from
tarekgh:release/6.0
Aug 31, 2021
Merged

[release/6.0] Fix TimeZoneInfo.HasIanaId when using Local Time Zone#58414
Anipik merged 1 commit into
dotnet:release/6.0from
tarekgh:release/6.0

Conversation

@tarekgh

@tarekgh tarekgh commented Aug 31, 2021

Copy link
Copy Markdown
Member

Fixes #58326

Backport of #58392 to release/6.0

/cc @tarekgh

Customer Impact

Without this fix, users of TimeZoneInfo.HasIanaId can get wrong values when using TimeZoneInfo.Local.

We have exposed the new property TimeZoneInfo.HasIanaId in .NET 6.0. This property tells if the Time Zone object is created with IANA Id. This property returns the correct results except when using TimeZoneInfo.Local. The reason is when we initialize TimeZoneInfo.Local property we clone the object before returning it, but we missed cloning HasIanaId property inside the returned object. The fix is to ensure HasIanaId is initialized correctly in TimeZoneInfo.Local.

Testing

I tested this on Windows and Linux. Also, I have run the whole regression tests with the fix without any problem. I added more tests to cover the test gap for the functionality we are fixing here.

Risk

Is low. The fix is scoped to the HasIanaId property only which is a newly exposed property in .NET 6.0. The change is well tested and added more tests too.

@ghost

ghost commented Aug 31, 2021

Copy link
Copy Markdown

Tagging subscribers to this area: @tarekgh, @safern
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #58326

Backport of #58392 to release/6.0

/cc @tarekgh

Customer Impact

Without this fix, users of TimeZoneInfo.HasIanaId can get wrong values when using TimeZoneInfo.Local.

We have exposed the new property TimeZoneInfo.HasIanaId in .NET 6.0. This property tells if the Time Zone object is created with IANA Id. This property returns the correct results except when using TimeZoneInfo.Local. The reason is when we initialize TimeZoneInfo.Local property we clone the object before returning it, but we missed cloning HasIanaId property inside the returned object. The fix is to ensure HasIanaId is initialized correctly in TimeZoneInfo.Local.

Testing

I tested this on Windows and Linux. Also, I have run the whole regression tests with the fix without any problem. I added more tests to cover the test gap for the functionality we are fixing here.

Risk

Is low. The fix is scoped to the HasIanaId property only which is a newly exposed property in .NET 6.0. The change is well tested and added more tests too.

Author: tarekgh
Assignees: -
Labels:

area-System.Globalization

Milestone: -

@tarekgh

tarekgh commented Aug 31, 2021

Copy link
Copy Markdown
Member Author

CC @danmoseley @ericstj

@danmoseley danmoseley requested a review from eerhardt August 31, 2021 02:53
@danmoseley

Copy link
Copy Markdown
Member

Approved for release/6.0. Clear defect in a new API, reported by partner, localized fix.

@tarekgh

tarekgh commented Aug 31, 2021

Copy link
Copy Markdown
Member Author

CC @eerhardt

@tarekgh

tarekgh commented Aug 31, 2021

Copy link
Copy Markdown
Member Author

CC @@roji

@tarekgh

tarekgh commented Aug 31, 2021

Copy link
Copy Markdown
Member Author

@danmoseley could you please merge this one? Thanks!

@Anipik Anipik merged commit 22b53e8 into dotnet:release/6.0 Aug 31, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Sep 30, 2021
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.

4 participants