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

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

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

Copy link
Copy Markdown
MemberAuthor

CC @danmoseley@ericstj

@danmoseley

Copy link
Copy Markdown
Contributor

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

@tarekgh

Copy link
Copy Markdown
MemberAuthor

CC @eerhardt

@tarekgh

Copy link
Copy Markdown
MemberAuthor

CC @@roji

@tarekgh

Copy link
Copy Markdown
MemberAuthor

@danmoseley could you please merge this one? Thanks!

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

@tarekgh@danmoseley@eerhardt@Anipik