Sonar-dotnet: S1450 not appearing in VS2015 IDE

Created on 6 Jun 2018  路  5Comments  路  Source: SonarSource/sonar-dotnet

Description

S1450 issues are not appearing in the VS2015 IDE.

Repro steps

namespace S1450_FalseNegativeInVS2015IDE
{
    public class Example1
    {
        int field; // << expecting S1450 to be raised here but does not appear in VS2015.3 IDE
        // It is correctly detected when running from the command line and in the VS2017 IDE

        public void Increment(int val)
        {
            field = val + 1;
        }
    }
}

Expected behavior

Please provide a description of the behavior you expect.

Actual behavior

The issue does not appear in the IDE, but it does appear when analysing during builds.

Known workarounds

Works as expected in VS2017.

Related information

  • SonarC# Version: 7.0+
  • Visual Studio Version: VS2015 Update 3

Note

1448 is a separate issue about a genuine false negative in the rule when using expression method bodies. This issue is about the diagnostic not appearing in the VS2015 IDE.

Bug

All 5 comments

Hi @duncanp-sonar, do you keep the project you used to reproduce the issue? I cannot reproduce it locally using the latest nuget:

image

Could this be caused by having "test" in the project name as I suggested in #1536?

@valhristov the project name was "BugsWIP" (attached) BugsWip.zip

It uses the analyzer embedded in SLVS rather than the NuGet.
I've tried repro-ing again, and the issue does appear sometimes but not always
e.g.

  • delete the .vs, bin and obj directories then open the project in VS -> issue does not appear (or appears briefly in the error list, then disappears)
  • build -> issue now appears correctly.

I suspect the issue might be with how the rule is being called in VS2015.3, rather than the rule itself.

@valhristov could you check whether your rule rewrite also fixes this issue?

It takes a couple of seconds for the issues to appear (not only S1450) but they appear consistently without the need to rebuild.

Closing the issue then!

Was this page helpful?
0 / 5 - 0 ratings