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

New rule S6575: Use TimeZoneInfo.FindSystemTimeZoneById instead of TimezoneConverter #7077

Closed
2 tasks
mary-georgiou-sonarsource opened this issue Apr 14, 2023 · 0 comments · Fixed by #7503
Closed
2 tasks
Assignees
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues. Type: New Rule Implementation for a rule that HAS been specified.
Milestone

Comments

@mary-georgiou-sonarsource
Copy link
Contributor

mary-georgiou-sonarsource commented Apr 14, 2023

Implement new rule S6575: Use TimeZoneInfo.FindSystemTimeZoneById instead of TimezoneConverter.

This rule should raise when the project targets .net6 and TimeZoneConverter methods for IANA and Windows Timezones are used.

  • IanaToWindows
  • WindowsToIana
  • TryIanaToWindows
  • TryWindowsToIana

TimeZoneConverter also covers Rails Timezones - we should not raise there as TimeZoneInfo.FindSystemTimeZoneById does not cover rails.

Hint: This rule concerns projects that target only .NET 6 and above. Here's how we currently detect framework versions.

  • Implement Rule S6575 for C#
  • Implement Rule S6575 for VB.NET
@mary-georgiou-sonarsource mary-georgiou-sonarsource added Area: VB.NET VB.NET rules related issues. Area: C# C# rules related issues. Type: New Rule Implementation for a rule that HAS been specified. labels Apr 14, 2023
@csaba-sagi-sonarsource csaba-sagi-sonarsource changed the title New rule S6575: Use TimeZoneInfo.FindSystemTimeZoneById instead of TimezoneConverter New rule S6575: Use TimeZoneInfo.FindSystemTimeZoneById instead of TimezoneConverter Apr 14, 2023
@csaba-sagi-sonarsource csaba-sagi-sonarsource changed the title New rule S6575: Use TimeZoneInfo.FindSystemTimeZoneById instead of TimezoneConverter New rule S6575: Use 'TimeZoneInfo.FindSystemTimeZoneById' instead of 'TimezoneConverter' Apr 14, 2023
@csaba-sagi-sonarsource csaba-sagi-sonarsource changed the title New rule S6575: Use 'TimeZoneInfo.FindSystemTimeZoneById' instead of 'TimezoneConverter' New rule S6575: Use TimeZoneInfo.FindSystemTimeZoneById instead of TimezoneConverter Apr 14, 2023
@csaba-sagi-sonarsource csaba-sagi-sonarsource changed the title New rule S6575: Use TimeZoneInfo.FindSystemTimeZoneById instead of TimezoneConverter New rule S6575: Use TimeZoneInfo.FindSystemTimeZoneById instead of TimezoneConverter Apr 14, 2023
@costin-zaharia-sonarsource costin-zaharia-sonarsource added this to the 9.4 milestone Jun 8, 2023
@costin-zaharia-sonarsource costin-zaharia-sonarsource removed this from the 9.4 milestone Jun 12, 2023
@csaba-sagi-sonarsource csaba-sagi-sonarsource added this to the 9.5 milestone Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues. Type: New Rule Implementation for a rule that HAS been specified.
Projects
None yet
4 participants