Analyzer working directory does not exist

Hi,
I am facing issue with code analysis of a c# project.
Any ideas how to solve this?
Thank you, Peter

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

SonarQube Version 9.3 (build 51899)
SonarScanner for MSBuild 5.7.1
csharp version 8.34.0.42011
MSBuild 15.9.21+g9802d43bc3 for .NET Framework

  • what are you trying to achieve

Code analysis for a smaller c# project.

Build works without errors.
Code analysis works for .sql and .xml files, however all .cs file show “-“ Lines of Code in the user interface under “Code”.

The log shows:

09:52:08.98 Dumping content of sonar-project.properties


ACB2D2DA-29B2-48E4-8118-4AC29DD257E0.sonar.cs.analyzer.projectOutPaths=
“C:\Users\–removed–\Build\.sonarqube\out\0”


09:52:14.063 INFO: Sensor C# Analysis Log [csharp]
09:52:14.071 DEBUG: Project –removed–: Analyzer working directory does not exist: ‘C:\Users*–removed–\Build.sonarqube\out\0\output-cs’. Analyzer results won’t be loaded from this directory.
09:52:14.071 INFO: Sensor C# Analysis Log [csharp] (done) | time=8ms
09:52:14.071 INFO: Sensor C# Properties [csharp]
09:52:14.071 DEBUG: Project –removed–: Analyzer working directory does not exist: 'C:\Users*–removed–
\Build.sonarqube\out\0\output-cs’. Analyzer results won’t be loaded from this directory.
09:52:15.499 INFO: Sensor C# Project Type Information [csharp]
09:52:15.499 INFO: Sensor C# Project Type Information [csharp] (done) | time=0ms
09:52:15.499 INFO: Sensor C# Analysis Log [csharp]
09:52:15.499 DEBUG: Project ‘SBFD’: Property missing: ‘sonar.cs.analyzer.projectOutPaths’. No protobuf files will be loaded for this project.
09:52:15.499 INFO: Sensor C# Analysis Log [csharp] (done) | time=0ms
09:52:15.499 INFO: Sensor C# Properties [csharp]
09:52:15.499 DEBUG: Project ‘SBFD’: Property missing: ‘sonar.cs.analyzer.projectOutPaths’. No protobuf files will be loaded for this project.
09:52:15.499 DEBUG: Project ‘SBFD’: No Roslyn issues reports have been found.
09:52:15.499 INFO: Sensor C# Properties [csharp] (done) | time=0ms

  • what have you tried so far to achieve this

Tried various versions of MSBuild (14, 15, 16)
Tried various version of SonarScanner for .net (5.4.0, 5.5.3, 5.6.0)

I was able to resolve the problem:

I found that the Analyzers are downloaded from the SonarQube server to C:\Temp.sonarqube

In this directory some DLLs were missing.

I suppose that the build job was terminated while the archive (.zip) which was downloaded from the SonarQube Server was unpacked.

I deleted all contents of C:\Temp.sonarqube and the problem was gone (the next build job re-downloaded the archives und unpacked them completely).

Steps to reproduce my error pattern above:
Go to C:\Temp.sonarqube\resources\0 (are likewise) and delete SonarAnalyzer.CSharp.dll

IMHO the existence of the needed DLL should be checked SonarScanner.

BR, Peter

1 Like

Hi Peter,

Welcome to the community!

I’m so glad you worked through this and even more glad that you bothered to come back and share your solution! This will definitely help others in the future!

 
Ann

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.