dotnet / dotnet/roslynator

RCS1155 String Comparison Bug

Open
#945 2 comments 2 reactions 0 assignees View on GitHub
Area-Analyzers Feature Request
Dominant language
C#
Stars
3.5k
Forks
294
Avg merge
2h 30m
Merged PRs (30d)
4

Description

**Product and Version Used**:
Roslynator 4.1.1
Visual Studio 17.3.1

**Steps to Reproduce**:
I have installed Roslynator from the visual studio marketplace for Visual Studio 2022 and have configured the .editorconfig for RCS1155 string comparison analyzer.

![image](https://user-images.githubusercontent.com/111488623/185336124-b4a0b55c-b9ac-48bf-a9b2-da387d1023e7.png)

**Issue/Bug**:
The following code snippet should show a warning in the Error List to use StringComparison when comparing strings however this is not happening.
```
if (example == "hi")
{
return false;
}
```
![image](https://user-images.githubusercontent.com/111488623/185337133-3406a5eb-2e8f-412a-9fa8-1445ec3ef141.png)

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. First reproduce the example == "hi" comparison in Visual Studio 2022 with the reported RCS1155 .editorconfig configuration, then trace the analyzer entry point; done means the comparison produces the expected StringComparison warning in the Error List.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.