Hi,
We are trying to fix all the sonarqube major and critical bugs in our projects. We cameup one scenario in which sonar is not analyzing the “ref” variable passed to a function. Below is the sample coe that we have and sonar is giving “(C#) Conditionally executed code should be reachable” issue.
Code sample,
public void TestExample(ref bool stop)
{
while (!stop)
while (true)
if (stop) break;
}
SonarQube is generating below error.
Is you see the code and the logic, it looks good, because stop is a referenced variable and it can be changes from any location in the project.
Can anyone please help me in resolving this sonar issue without excluding this file from sonar.
