Proxy settings (SONAR_SCANNER_OPTS) not supported by SonarScanner for .NET

Hi,

We would like to migrate from SQ 7.9 LTS to SQ 8.9 LTS Enterprise, but we have a problem with the Scanner for .NET that blocks the migration.

We followed exactly the steps described under “ Using SonarScanner for .NET with a Proxy ” but the description is wrong:

https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/#header-7

We did a code review of the SonarScanner for .NET and found that the SONAR_SCANNER_OPTS environment variable is not supported:

  • We don’t see in the source code that the .NET Scanner 5.2.2 is processing the SONAR_SCANNER_OPTS environment variable in the begin step like it should.
  • no -Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port> are read from the environment
  • The class SonarScanner.MSBuild.PreProcessor.WebClientDownloader does not use any WebProxy for the HttpClientHandler it creates in the ctor, despite it needs that in order to get the bootstrap index from the server
  • fails with error message HTTP 407 - Proxy Authentication Required

linked to Error in MSBuild.Scanner end step

What are your plans to fix this issue?

Regards,

Hi Günter

You are correct that the Scanner for .NET does not recognise the proxy from SONAR_SCANNER_OPTS although this is still required because Scanner for .NET wraps the SonarScanner that uses it.

For Scanner for .NET you will also need to set the .NET specific proxy settings (HTTP_PROXY , HTTPS_PROXY or ALL_PROXY) as described in the final paragraph of the documentation section. I recognise that this is not at all clear and I will look at getting this updated with something more useful as soon as I can.

HTTP_PROXY , HTTPS_PROXY , ALL_PROXY , and NO_PROXY will be automatically recognized and use to make call against SonarQube. The Scanner for .NET makes HTTP calls, independant from the settings above concerning the Java VM, to fetch the Quality Profile and other useful settings for the “end” step.

Apologies for the problems this has caused.

Tom