Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented Sep 15, 2019

Fixes https://github.com/dotnet/corefx/issues/40953

When creating a new culture, we’ll have the equality CultureInfo.DateTimeInfo.Calendar == CultureInfo.calendar be true. After cloning such culture, this equality would not be true. The fix here is to ensure if the equality is true before cloning then should be true after cloning.

When creating a new culture, we’ll have the equality CultureInfo.DateTimeInfo.Calendar == CultureInfo.calendar be true. After cloning such culture, this equality would not be true. The fix here is to ensure if the equality is true before cloning then should be true after cloning.
@tarekgh
Copy link
Member Author

tarekgh commented Sep 15, 2019

CC @stephentoub @krwq

I am going to create the test PR for this change soon.

@tarekgh tarekgh merged commit 634bf8c into dotnet:master Sep 16, 2019
@tarekgh
Copy link
Member Author

tarekgh commented Sep 16, 2019

Thanks @krwq for your review.

{
// Usually when we access CultureInfo.DateTimeFormat first time, we create the DateTimeFormatInfo object
// using CultureInfo.Calendar. i.e. CultureInfo.DateTimeInfo.Calendar == CultureInfo.calendar.
// When cloning CultureInfo, if we know this still the case CultureInfo.DateTimeInfo.Calendar == CultureInfo.calendar
Copy link
Member

Choose a reason for hiding this comment

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

Nit: "if we know this still the case" => "if we know it's still the case that"

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, I already merged the change. I can try to fix that next time I change something in coreclr. thanks for the comment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in CultureInfo.Clone() causes .Calendar and .DateTimeFormat.Calendar to diverge
3 participants