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

Fix S101: "Class Name" infinite loop when class name contains non-Latin Characters #526

Closed
czphoenix opened this issue Jul 3, 2017 · 1 comment
Assignees
Labels
Type: Bug Exceptions and blocking issues during analysis.
Milestone

Comments

@czphoenix
Copy link

Description

There will be a infinite loop in
File: SonarAnalyzer.CSharp/Rules/ClassName.cs
Class: internal class CamelCaseConverter
Method: public static string Convert(string identifierName)
When
char.IsLower(suggestion[currentIndex])
char.IsNumber(suggestion[currentIndex])
char.IsUpper(suggestion[currentIndex])
all return false

Repro steps

  1. Create a project with a class named in non-Latin characters. e.g. Chinese which is fine in C#.
    class 你好{}

  2. Run.

Expected behavior

Finish when done.

Actual behavior

Runs forever with high CPU usage.

Known workarounds

Use all Latin characters in class name.

Related information

  • SonarC# Version: 6.0.0.2033
  • Visual Studio Version: 2017
  • If running through the Scanner for MSBuild, its version: MSBuild15
@valhristov
Copy link
Contributor

Hi @czphoenix,

Thanks for the bug report, and don't hesitate to send us more, we appreciate it!

Valeri

@valhristov valhristov added Area: Rules Type: Bug Exceptions and blocking issues during analysis. labels Jul 6, 2017
@valhristov valhristov changed the title Class Name with non-Latin Characters Fix S110: "Class Name" infinite loop when class name contains non-Latin Characters Jul 6, 2017
@valhristov valhristov added this to the near-future milestone Jul 6, 2017
@Evangelink Evangelink modified the milestones: 6.3, near-future Jul 13, 2017
@michalb-sonar michalb-sonar changed the title Fix S110: "Class Name" infinite loop when class name contains non-Latin Characters Fix S101: "Class Name" infinite loop when class name contains non-Latin Characters Jul 19, 2017
@michalb-sonar michalb-sonar self-assigned this Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Exceptions and blocking issues during analysis.
Projects
None yet
Development

No branches or pull requests

4 participants