Builds fail with CompilerServer: server failed due to MVID

  • SonarQube Enterprise Edition Version 9.3 (build 51899)

  • SonarScanner for MSBuild 5.5.3

  • Azure DevOps Server 2020 Update 1

  • SonarQube Azure DevOps Extension 5.4.0 (Latest)

  • Error observed:

2022-03-24T21:11:03.2255032Z   CompilerServer: server failed - server rejected the request due to analyzer / generator issues 'analyzer assembly 'C:\T\.sonarqube\resources\2\System.Buffers.dll' has MVID '36e84b0d-9d74-4086-a062-54e1963f24d5' but loaded assembly 'System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' has MVID 'f389ca43-32bf-4e24-ad8c-a6ed5efddff3', analyzer assembly 'C:\T\.sonarqube\resources\2\System.Numerics.Vectors.dll' has MVID '95de52ab-0179-450a-9f6f-08d224d60b15' but loaded assembly 'System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' has MVID '34905ed1-db9d-4250-b31b-b80e1ff70ff5', analyzer assembly 'C:\T\.sonarqube\resources\2\System.Runtime.CompilerServices.Unsafe.dll' has MVID 'bd600ba8-23b5-4d45-ba63-f24457fa3be3' but loaded assembly 'System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' has MVID '9dde2c5e-b52a-4cbd-861e-9aacf36593ce'' - 3d788b85-3773-4551-9ffa-55244e26d6f6

Further, any build attempt will fail in the same way for this build agent in subsequent builds even after the SonarQube tasks have been removed from the pipeline as the build environment is left dirty.

  • Steps to reproduce
    Add SonarQubePrepare@5 task to a working Roslyn build pipeline

  • Potential workaround
    Using the same package versions as Sonar, as mentioned here .

We are investigating if this is a valid workaround for us but are concerned about continually encountering this in the future and are wondering about longer term solution to the problem?

Thanks in advance!
Steve

Hi @ssmashnuk,

The described compiler error will be fixed in the next SonarQube release which should happen next week.

Until then, would it be possible to share the build logs? Normally the build should not fail, even if this error is displayed.

Hi Costin,

Thanks for getting back to me. Do you have a way I can share them privately? They are about 12MB in size.

Steve

Hi Steve,

I’ve sent you a PM.

Thanks a lot for the logs. I took a short look and I’ve noticed that all the warnings raised by the analyzers are considered errors:

error S1125: Remove the unnecessary Boolean literal(s).

I would say that the failed build is to be expected due to the fact that /WarnAsError parameter was provided during the project build.

In order to have a successful build, you need to remove this parameter. See: C# Compiler Options - errors and warnings - C# | Microsoft Learn

All warning messages are instead reported as errors. The build process halts (no output files are built). By default, TreatWarningsAsErrors isn’t in effect, which means warnings don’t prevent the generation of an output file.

Thanks Costin, I’ve forwarded this to the developer in charge of this for review.