SonarLint can't bind to project

I’m using
Microsoft Visual Studio Enterprise 2019 Version 16.7.5
SonarLint for Visual Studio
SonarQube Version 6.7.7 (build 38951)

I’m able to connect to SonarQube from Visual Studio but when I try to bind to a project I got these error:

Failed to bind the solution to SonarQube project, try again.
See more information in the output window (SonarLint).

And the output shows that:

Binding solution to SonarQube project: Download quality profile(s):
Successfully downloaded quality profile. Name: ‘Sonar way (outdated copy)’, Key: ‘cs-sonar-way-35493’, Language: ‘C#’
INFO: SonarLint connected mode no longer installs the analyzers NuGet packages. The analyzers embedded in the VSIX are used instead.
Binding solution to SonarQube project: Generating project rule sets
Ruleset binding: all projects need to be updated reference the generated ruleset.
Failed to write credentials, Win32ErrorCode: 1312. See for more information.
Unexpected error during workflow execution: Failed to write credentials.

Hi @bsalmeida, welcome to the community.

Are you running VS with impersonation?
During the binding process, we save the credentials into Windows’ credentials store.
Error code 1312 (ERROR_NO_SUCH_LOGON_SESSION) can happen when the code runs under impersonation context (see a similar stackoverflow thread).
If you’re running with impersonation, then please run VS without and then the binding should work.

EDIT: according to MS’ documentation, you will also get this error if you’re in a network session, e.g. logged in via Remote Desktop, Remote Assistance, etc.

Hi Rita!

In my company everyone runs VS with impersonation (as ADMIN), but some people can bind projects. Probably the answer is the Remote Desktop that I’m using.

Hi Bruno,

It’s probably indeed due to Remote Desktop. I’m sorry, I don’t have a way to fix that as it’s a Windows limitation. You will need to run VS outside of Remote Desktop for SonarLint to be able to store the credentials.