SonarLint on VS2022 cannot synchronize taint

Please provide

  • Operating System: Windows 11 Enterprise
  • SonarLint plugin version: 6.16
  • Programming language you’re coding in: c#
  • Is connected mode used: yes
    • Connected to SonarCloud or SonarQube (and which version): connected to SonarQube 10.0.0.0-developer

And a thorough description of the problem / question:
I have a SonarQube setup in Azure ContainerApp. It deploys from docker image version 10.0.0.0-developer.

I want to use SonarLint in VisualStudio 2022 Version 17.4.3 with Connected Mode. I’m able to connect to my SonarQube instance (it does download rules and shows issues in the code). When I look into logs though I see that while it connects to SonarQube it is not able to synchronize taint vulnerabilities.

This is full log I get:

Initializing the telemetry package...
Loaded settings from "C:\Users\{MyUser}\AppData\Roaming\SonarLint for Visual Studio\settings.json".
No open solution or folder
Current VS version:
    Visual Studio Professional 2022
    17.4.33205.214
    17.4.3
Finished initializing the telemetry package...
Initializing the daemon package...
[Open in IDE] Creating request listener...
Finished initializing the daemon package.
[Open in IDE] Checking availability of port 64120
[Open in IDE] Request listener created successfully. Listening on port 64120.
Connecting to 'https://{sonarqube_address}/'.
[SecretsAnalyzer] Analyzing C:\{ProjectDirectory}\Core\App\App.Core.csproj
[SecretsAnalyzer] Finished analyzing C:\{ProjectDirectory}\Core\App\App.Core.csproj, analysis time: 0.037s
[SecretsAnalyzer] Found 0 issue(s) for C:\{ProjectDirectory}\Core\App\App.Core.csproj
Connected to SonarQube '10.0.0.68432'.
Checking for unbound projects.
No unbound projects were found.
Initializing the SonarLint package...
Finishing initializing the SonarLint package
Checking if SonarQube Quality profile has changed.
Initializing the notifications package...
Loading notifications settings...
Connected: checking for notifications
Finished initializing the notifications package
Quality Profile is up-to-date.
[ConnectedMode] Initializing package...
[ConnectedMode] Package initialized
[Suppressions] Fetching all suppressions...
[Taint] Initializing taint issues synchronization package...
[ConnectedMode/BranchMapping] Matching Sonar server branch: netcore3_1
[ConnectedMode/BranchMapping] Closest Sonar server branch: netcore3_1
[ConnectedMode/BranchMapping] Matching Sonar server branch: netcore3_1
[ConnectedMode/BranchMapping] Closest Sonar server branch: netcore3_1
[ServerIssueStore] Raising change event...
[Suppressions] Finished fetching all suppressions
[Taint] Failed to synchronize taint vulnerabilities with the connected server: System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at SonarQube.Client.Requests.RequestBase`1.<InvokeAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarQube.Client.SonarQubeService.<InvokeUncheckedRequestAsync>d__17`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarLint.VisualStudio.Infrastructure.VS.ThreadHandling.<>c__DisplayClass5_0`1.<<RunOnBackgroundThread>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarLint.VisualStudio.Infrastructure.VS.ThreadHandling.<RunOnBackgroundThread>d__5`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarLint.VisualStudio.Integration.MefServices.MefSonarQubeService.<InvokeUncheckedRequestAsync>d__3`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarQube.Client.SonarQubeService.<GetSourceCodeAsync>d__39.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at SonarQube.Client.Helpers.SecondaryLocationHashUpdater.<UpdateHashesAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarQube.Client.SonarQubeService.<GetTaintVulnerabilitiesAsync>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarLint.VisualStudio.IssueVisualization.Security.Taint.TaintIssuesSynchronizer.<SynchronizeWithServer>d__11.MoveNext().
[Taint] Finished initializing taint issues synchronization package.
[SecretsAnalyzer] Analyzing C:\{ProjectDirectory}\Modules\Search\Services\AzureSearchService.cs
Loaded settings from "C:\{ProjectDirectory}\.sonarlint\{project_name}_aygj2s6nub5iljyxomjv_secrets_settings.json".
[RuleSettings] Using connected mode settings. User-specified settings in settings.json will be ignored.
[SecretsAnalyzer] Finished analyzing C:\{ProjectDirectory}\Modules\Search\Services\AzureSearchService.cs, analysis time: 0.148s
[SecretsAnalyzer] Found 0 issue(s) for C:\{ProjectDirectory}\Modules\Search\Services\AzureSearchService.cs
[SecretsAnalyzer] Analyzing C:\{ProjectDirectory}\Core\App\Areas\Company\Controllers\MeetingsController.cs
Loaded settings from "C:\{ProjectDirectory}\.sonarlint\{project_name}_aygj2s6nub5iljyxomjv_secrets_settings.json".
[RuleSettings] Using connected mode settings. User-specified settings in settings.json will be ignored.
[SecretsAnalyzer] Finished analyzing C:\{ProjectDirectory}\Core\App\Areas\Company\Controllers\MeetingsController.cs, analysis time: 0.005s
[SecretsAnalyzer] Found 0 issue(s) for C:\{ProjectDirectory}\Core\App\Areas\Company\Controllers\MeetingsController.cs
[NodeJSLocator] Checking environment variable SONAR_NODEJS_PATH
[NodeJsLocator] Environment variable is not set
[NodeJsLocator] Found compatible Node.js version: 18.12.1. Path: C:\Program Files\nodejs\node.exe
[NodeJSLocator] Checking environment variable SONAR_NODEJS_PATH
[NodeJsLocator] Environment variable is not set
Saving notifications settings...
[Suppressions] Fetching all suppressions...
[ConnectedMode/BranchMapping] Closest Sonar server branch: netcore3_1
[ServerIssueStore] Raising change event...
[Suppressions] Finished fetching all suppressions
[SecretsAnalyzer] Analyzing C:\{ProjectDirectory}\Core\Common\Extensions\StringExtensions.cs
Loaded settings from "C:\{ProjectDirectory}\.sonarlint\{project_name}_aygj2s6nub5iljyxomjv_secrets_settings.json".
[RuleSettings] Using connected mode settings. User-specified settings in settings.json will be ignored.
[SecretsAnalyzer] Finished analyzing C:\{ProjectDirectory}\Core\Common\Extensions\StringExtensions.cs, analysis time: 0.011s
[SecretsAnalyzer] Found 0 issue(s) for C:\{ProjectDirectory}\Core\Common\Extensions\StringExtensions.cs
[SecretsAnalyzer] Analyzing C:\{ProjectDirectory}\.sonarlint\{project_name}_aygj2s6nub5iljyxomjv_css_settings.json
Loaded settings from "C:\{ProjectDirectory}\.sonarlint\{project_name}_aygj2s6nub5iljyxomjv_secrets_settings.json".
[RuleSettings] Using connected mode settings. User-specified settings in settings.json will be ignored.
[SecretsAnalyzer] Finished analyzing C:\{ProjectDirectory}\.sonarlint\{project_name}_aygj2s6nub5iljyxomjv_css_settings.json, analysis time: 0.004s
[SecretsAnalyzer] Found 0 issue(s) for C:\{ProjectDirectory}\.sonarlint\{project_name}_aygj2s6nub5iljyxomjv_css_settings.json
[Suppressions] Fetching all suppressions...
[Suppressions] Fetching all suppressions...
[Suppressions] Fetching all suppressions...
Connecting to SonarQube server: https://{sonarqube_address}/
Connecting to SonarQube server: Validating credentials
Connecting to SonarQube server: Detecting server plugins
[ProjectLanguageIndicator] Failed to identify languages files in project 'Miscellaneous Files': System.NullReferenceException: Object reference not set to an instance of an object.
   at SonarLint.VisualStudio.Integration.Binding.ProjectLanguageIndicator.HasFileInProject(ProjectItems projectItems, ITargetLanguagePredicate analysisTargetLanguages)
   at SonarLint.VisualStudio.Integration.Binding.ProjectLanguageIndicator.HasTargetLanguage(Project dteProject, ITargetLanguagePredicate targetLanguagePredicate)
   Discovered a supported plugin: Plugin: 'SonarC#', Language(s): 'C#', Installed version: '8.55.0', Minimum version: '5.0'
   Discovered a supported plugin: Plugin: 'SonarVB', Language(s): 'VB.NET', Installed version: '8.55.0', Minimum version: '3.0'
   Discovered a supported plugin: Plugin: 'SonarCFamily', Language(s): 'C++, C', Installed version: '6.43.0', Minimum version: '6.0'
   Discovered a supported plugin: Plugin: 'SonarJS', Language(s): 'JavaScript, TypeScript, CSS', Installed version: '10.1.0', Minimum version: '8.6'
   Discovered a supported plugin: Plugin: 'SonarSecrets', Language(s): 'Secrets', Installed version: '2.0.2', Minimum version: '2.0.1'
Connecting to SonarQube server: Retrieving projects
[Suppressions] Fetching all suppressions...
Connecting to SonarQube server: Succeeded
Connecting to SonarQube server: Downloading server settings.
[Suppressions] Fetching all suppressions...

This is interesting part: [Taint] Failed to synchronize taint vulnerabilities with the connected server: System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).

Anyone have ideas why this might happen?

Hi @Lleczycki,

It seems like a credentials issue and an easy workaround to resolve this;

  1. Create a new dummy solution.
  2. Bind this solution to the existing SonarQube project (you can delete the dummy solution after this step)
  3. Reopen the original solution and see if the behaviour is changed.