Why do compiler gives error instead of warning for variable which is assigned but its value is never used

Hi All,

I have set VSTS pipeline with SonarQube task and when I’m running this pipeline I’m getting error for variable that is not used and build is failing. Due to this no analysis results are shown on sonar dashboard.


Do you face this issue if you disable the SonarQube tasks in your build?

It’s also probably a good idea to share full, text-based logs. There’s not a lot we can tell from a screenshot.


Hi Colin,

I tried running pipeline after disabling sonar tasks but still getting same error. Attached is the log (size(5 MB) was too big to attach so removed unwanted logs and split log into 2 parts)log1.txt (362.0 KB) log2.txt (34.0 KB)

Ah, sorry that we can’t help then. :confused: Sounds like you need to fix your build, and then revisit SonarQube analysis. SonarQube needs a successful build for C# analysis.

Build is ok. Issue is it gives error for warning and build gets fail.

I’m not sure if those errors are supposed to fail your build (I’m not a C# or MSBuild expert), but if your build treating warnings as errors (and you don’t want it to!), you should probably address that first.