Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.TimeZoneInfo.AdjustmentRule is missing object.Equals(object) override #8161

Open
ViktorHofer opened this issue May 19, 2017 · 3 comments
Labels
area-System.DateTime bug enhancement Product code improvement that does NOT require public API changes/additions
Milestone

Comments

@ViktorHofer
Copy link
Member

Applies to both netfx and corefx.

Netfx: https://referencesource.microsoft.com/#mscorlib/system/timezoneinfo.cs,3066
Core: https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/System/TimeZoneInfo.AdjustmentRule.cs#L46

Repro

var a = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1900, 1, 1), 
    new DateTime(1955, 12, 31),
    TimeSpan.FromHours(2), 
    TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 2, 0, 0), 2, 3), 
    TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 2, 0, 0), 3, 4));

var b = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1900, 1, 1), 
    new DateTime(1955, 12, 31),
    TimeSpan.FromHours(2), 
    TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 2, 0, 0), 2, 3), 
    TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 2, 0, 0), 3, 4));

Console.WriteLine("ReferenceEquals: " + ReferenceEquals(a, b)); // false
Console.WriteLine("a == null: " + (a == null)); // false
Console.WriteLine("b == null: " + (b == null)); // false
Console.WriteLine("a == b: " + (a == b)); // false
Console.WriteLine("a.equals(b): " + a.Equals(b)); // true
Console.WriteLine("Object.Equals: " + Object.Equals(a, b)); // false

cc @danmosemsft

@ViktorHofer ViktorHofer self-assigned this May 19, 2017
@ViktorHofer
Copy link
Member Author

cc @stephentoub

@stephentoub
Copy link
Member

@tarekgh?

@tarekgh
Copy link
Member

tarekgh commented May 23, 2017

I think this will apply to many types and not just AdjustmentRule. I would hesitate to change anything in TZ in general before we figure out the plans for the other requests. there is a possibility we deprecate AdjustmentRule for the sake more fixable way in handling TZ and its rules.

@ViktorHofer ViktorHofer removed their assignment Jun 27, 2017
@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the Future milestone Jan 31, 2020
@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 26, 2020
@joperezr joperezr added enhancement Product code improvement that does NOT require public API changes/additions and removed untriaged New issue has not been triaged by the area owner labels Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.DateTime bug enhancement Product code improvement that does NOT require public API changes/additions
Projects
None yet
Development

No branches or pull requests

7 participants