New Install: warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.DoNotHideBaseClassMethods cannot be created

Forgive me I am a SonarQube newbie… So I got the system communicating this morning, but now I had a chance to look at the build logs. Even though the build was successful and I can see entries in SonarQube, I’m wondering what these errors mean and if I should be concerned. I have attached the Build.txt log incase you want to see everything.

2018-08-02T22:46:53.2628384Z ##[warning]CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.ThreadStaticWithInitializer cannot be created from C:\Users\Administrator\AppData\Local\Temp\1\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
2018-08-02T22:46:53.2628384Z      2>CSC : warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.ThreadStaticWithInitializer cannot be created from C:\Users\Administrator\AppData\Local\Temp\1\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. [C:\Agent\_work\3\s\TestAppForPD\TestAppForPD.csproj]
2018-08-02T22:46:53.2628384Z ##[warning]CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.MutableFieldsShouldNotBePublicReadonly cannot be created from C:\Users\Administrator\AppData\Local\Temp\1\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
2018-08-02T22:46:53.2628384Z      2>CSC : warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.MutableFieldsShouldNotBePublicReadonly cannot be created from C:\Users\Administrator\AppData\Local\Temp\1\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. [C:\Agent\_work\3\s\TestAppForPD\TestAppForPD.csproj]
2018-08-02T22:46:53.2628384Z ##[warning]CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.GetHashCodeEqualsOverride cannot be created from C:\Users\Administrator\AppData\Local\Temp\1\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
2018-08-02T22:46:53.2628384Z      2>CSC : warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.GetHashCodeEqualsOverride cannot be created from C:\Users\Administrator\AppData\Local\Temp\1\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. [C:\Agent\_work\3\s\TestAppForPD\TestAppForPD.csproj]
2018-08-02T22:46:53.2628384Z ##[warning]CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.CallToAsyncMethodShouldNotBeBlocking cannot be created from C:\Users\Administrator\AppData\Local\Temp\1\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
2018-08-02T22:46:53.2628384Z      2>CSC : warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.CallToAsyncMethodShouldNotBeBlocking cannot be created from C:\Users\Administrator\AppData\Local\Temp\1\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. [C:\Agent\_work\3\s\TestAppForPD\TestAppForPD.csproj]
2018-08-02T22:46:53.2784390Z ##[warning]CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.FrameworkTypeNaming cannot be created from C:\Users\Administrator\AppData\Local\Temp\1\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
2018-08-02T22:46:53.2784390Z      2>CSC : warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.FrameworkTypeNaming cannot be created from C:\Users\Administrator\AppData\Local\Temp\1\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. [C:\Agent\_work\3\s\TestAppForPD\TestAppForPD.csproj]

1_Build.txt (514.7 KB)

Thoughts?

Thanks for all the help so far.

Hi @patdelaney,

Most likely you don’t have the correct version of MSBuild installed on your machine. The version of SonarC# you are using requires at least the update 3 of MSBuild 14/Visual Studio 2015.

Could you check out you do have this version installed on your machine?

Cheers,
Amaury

Here is what I have installed on the build server. I pulled this from the Capabilities section of the agent:
msbuild

Hi,

Sadly we cannot tell appart the update version of MSBuild just by looking at the first 2 version numbers. You need to ensure to install either Visual Studio 2015 Update 3 or Build Tools 2015 Update 3.

When running msbuild /? you should have a line equivalent to Microsoft (R) Build Engine version 14.0.25420.1. If you don’t have this version then you need to update.

Cheers,
Amaury

Here is the output of msbuild /version

C:\Program Files (x86)\Microsoft Visual Studio 14.0>msbuild /version
Microsoft ® Build Engine version 14.0.23107.0
Copyright © Microsoft Corporation. All rights reserved.

14.0.23107.0
C:\Program Files (x86)\Microsoft Visual Studio 14.0>

Patrick,

That version maps to the RTM of Visual Studio 2015 / Build Tools 2015. You need to update to Visual Studio 2015 / Build Tools 2015 Update 3 or later

Colin

OK I am doing that now.

Hi Amaury,

I have the same problem but I had already downloaded MSBuild_14.0 on our test server from the link you provided and found this page after having the same problem. Today I’ve downloaded again from the link you provided and I checked that the file version is still 14.0.23107.10

On my local PC, I don’t have this issue since I have VS 2015 Update 3 installed. How can I upgrade to Build Tools 2015 Update 3 without installing VS?

Hi @veruyandi,

The version you are mentioning (i.e. 14.0.23107.10) matches the version of Build Tools 2015 no update. As @Colin said you need to be on Update 3 (i.e. 14.0.25420.1).

Thanks Amaury, but I already got that. May be I was a bit unclear, but in short, from the link you provided, I can only install Build Tools 2015 no update, not the update 3.

After some search, I found what I look for and will share it here in case anybody has the same issue.

Build Tools 2015 Update 3
https://go.microsoft.com/fwlink/?LinkId=615458

Reference: https://github.com/Microsoft/msbuild/issues/480

Hi

I have this exact same problem, but I am using VS 2015 Update 3
msbuild is version 14.0.25420.1
Sonar Cude 6.7.4
Sonar Scanner 4.6.0.1930

and getting this error too:
Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.ThreadStaticWithInitializer cannot be created from C:\Users\Administrator\AppData\Local\Temp\1.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies.

Any ideas would be fantastic please, thanks

Update 1, i think its fixed ……by :
Downgrading Sonarqube from 6.7 to 6.5
and installing Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform in VS NuGET Manager as suggested in another thread, but the analysis seems to be working now . :slight_smile:

Update 2:
I decided to upgrade back to version 6.7 and again received the Microsoft.CodeAnalysis Error, after more forum search’s the answer came from @Ammo on another forum, the answer is to install

Microsoft.Net.Compilers nuget to at least v1.3.1

AND THIS WORKED :slight_smile:
Thanks @Ammo

https://github.com/SonarSource/sonar-dotnet/issues/1828#issuecomment-425828427

Hi there,
I’m periodically facing this issue. This is not related to the version of msbuild we’re using as on a basis, it works fine. But for some builds, we’re having this error.
The solution we found so far is to delete the .sonarqube folder in user temp, but this is not a long term fix right.
I think the issue is related to the fact this shared folder is used by multiple different CI jobs, potentially having different msbuild/.net/whatever configuration, potentially running at the same time.
It would be better probably to put this .sonarqube in the current workspace of the job, instead in user temp, this would avoid collision between different builds.
Is there any option to control where this .sonarqube folder is installed?