Failed to write credentials

  • Operating system: Windows 11
  • Visual Studio version: 2022
  • SonarQube for Visual Studio plugin version: 8.11.0.11944
  • Programming language you’re coding in: C++
  • Is connected mode used: SonarQube Cloud

I am constantly getting the Failed to write credentials, Win32ErrorCode: 1312. I tried all the solutions on the internet. I don’t have a problem connecting using Visual Studio Code and its SonarLint extension. Might it be caused by internal company policies or other constraints? For some reason, the Visual Studio is always started as an Admin. I am not using a remote desktop, etc.
image

Hi,

Can you copy/paste the text of a verbose log, please?

 
Thx,
Ann

Hi,

This is it:

[ThreadId 1] Initializing the telemetry package...
[ThreadId 1] Finished initializing the telemetry package...
[ThreadId 72] Initializing the daemon package...
[ThreadId 72] [Connection Migration] Start migrating connections from existing bindings
[ThreadId 72] [Connection Migration] End migrating connections from existing bindings
[DEBUG] [ThreadId 1] [ConnectedMode/GitMonitor] Monitoring git repo. Root path: C:\Users\MR3295\Projects\SA_Platform
[ThreadId 30] [SLCoreHandler] Creating SLCore instance
[ThreadId 30] [SLCoreHandler] Starting SLCore instance
[ThreadId 30] Loaded settings from "C:\Users\MR3295\AppData\Roaming\SonarLint for Visual Studio\settings.json".
[ThreadId 1] Current VS version:
    Visual Studio Professional 2022
    17.8.34322.80
    17.8.2
[ThreadId 30] [NodeJSLocator] Checking environment variable SONAR_NODEJS_PATH
[ThreadId 30] [NodeJsLocator] Environment variable is not set
[ThreadId 30] Finished initializing the daemon package.
[DEBUG] [ThreadId 6] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Error while starting port: 64120, Address already in use: bind
[DEBUG] [ThreadId 6] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Error while starting port: 64121, Address already in use: bind
[DEBUG] [ThreadId 6] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Started embedded server on port 64122
[DEBUG] [ThreadId 53] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Restoring previous local-only issue database from C:\Users\MR3295\AppData\Local\SLVS_SLOOP\storageRoot\local_only_issue_backup.tar.gz
[DEBUG] [ThreadId 7] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Starting local-only issue database from C:\Users\MR3295\AppData\Local\SLVS_SLOOP\workDir\xodus-local-only-issue-store2357734951032642859
[ThreadId 6] [SLCore] [jetbrains.exodus.io.FileDataWriter > SonarLint Server RPC sequential executor] Can't open directory channel. Log directory fsync won't be performed.
[DEBUG] [ThreadId 28] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Using default trace sample rate: 0.01
[DEBUG] [ThreadId 28] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Monitoring is disabled by feature flag.
[ThreadId 1] Initializing the SonarQube for Visual Studio package...
[ThreadId 1] Finishing initializing the SonarQube for Visual Studio package
[DEBUG] [ThreadId 1] [SharedBindingConfigFileProvider] Unable to read shared config file: Could not find file 'C:\Users\MR3295\Projects\SA_Platform\.sonarlint\SA_Platform.json'.
[DEBUG] [ThreadId 30] [SLCore] [sonarlint > Connection Suggestion Provider] Computing connection suggestions
[DEBUG] [ThreadId 30] [SLCore] [sonarlint > SonarLint Server RPC sequential executor] Synchronizing new configuration scopes: [SA_Platform]
[ThreadId 55] Updated analysis readiness: True
[DEBUG] [ThreadId 28] [SLCore] [sonarlint > Connection Suggestion Provider] Extracting scanner properties from file:///C:/Users/MR3295/Projects/SA_Platform/.sonarlint/bcmapcnv.json
[DEBUG] [ThreadId 19] [SLCore] [sonarlint > Connection Suggestion Provider] Found a SonarLint configuration file with a clue
[DEBUG] [ThreadId 19] [SLCore] [sonarlint > Connection Suggestion Provider] Found 1 binding clue from SonarLint configuration files
[DEBUG] [ThreadId 19] [SLCore] [sonarlint > Connection Suggestion Provider] Found a SonarCloud binding clue
[DEBUG] [ThreadId 19] [SLCore] [sonarlint > Connection Suggestion Provider] Found 1 connection suggestion
[DEBUG] [ThreadId 24] [SLCore] [sonarlint > SonarLint Server RPC request executor] GET 200 https://sonarcloud.io/api/system/status | response time=633ms
[DEBUG] [ThreadId 24] [SLCore] [sonarlint > SonarLint Server RPC request executor] Downloaded server infos in 633ms
[DEBUG] [ThreadId 11] [SLCore] [sonarlint > SonarLint Server RPC request executor] GET 200 https://sonarcloud.io/api/authentication/validate?format=json | response time=246ms
[DEBUG] [ThreadId 14] [SLCore] [sonarlint > SonarLint Server RPC request executor] Load user organizations...
[DEBUG] [ThreadId 30] [SLCore] [sonarlint > SonarLint Server RPC request executor] GET 200 https://sonarcloud.io/api/organizations/search.protobuf?member=true&ps=500&p=1 | response time=2929ms
[DEBUG] [ThreadId 67] [SLCore] [sonarlint > SonarLint Server RPC request executor] Page downloaded in 2961ms
[DEBUG] [ThreadId 67] [SLCore] [sonarlint > SonarLint Server RPC request executor] Creating index for 2 organizations
[DEBUG] [ThreadId 58] [SLCore] [sonarlint > SonarLint Server RPC request executor] GET 200 https://sonarcloud.io/api/system/status | response time=258ms
[DEBUG] [ThreadId 58] [SLCore] [sonarlint > SonarLint Server RPC request executor] Downloaded server infos in 259ms
[DEBUG] [ThreadId 5] [SLCore] [sonarlint > SonarLint Server RPC request executor] GET 200 https://sonarcloud.io/api/authentication/validate?format=json | response time=238ms
[DEBUG] [ThreadId 24] [SLCore] [sonarlint > SonarLint Server RPC request executor] GET 200 https://sonarcloud.io/api/organizations/search.protobuf?organizations=hesc1&ps=500&p=1 | response time=1691ms
[DEBUG] [ThreadId 24] [SLCore] [sonarlint > SonarLint Server RPC request executor] Page downloaded in 1691ms
[ThreadId 1] Failed to write credentials, Win32ErrorCode: 1312. See https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes for more information.
[ThreadId 1] Failed adding server connection: Failed to write credentials
[DEBUG] [ThreadId 1] [SharedBindingConfigFileProvider] Unable to read shared config file: Could not find file 'C:\Users\MR3295\Projects\SA_Platform\.sonarlint\SA_Platform.json'.

Hi,

Thanks for the log.

Can you try this?

 
Thx,
Ann

I already checked this option, this is disabled:
image

Hi,

Thanks for checking. I’ve flagged this for the team.

 
Ann

Hi @RybaMaciej

Unfortunately, I am not able to reproduce this problem locally running under Admin privileges. Still, could you try launching your VS without Admin privileges and repeating the process?

If that doesn’t work, would you be open to running a custom build with some additional logging? As things stand now, there’s not enough information for me to understand what’s going on

JFYI: you’re not having similar problems with SQ for VSCode due to it storing credentials in a different way

Hi,

I think it could be possible to run a custom build if it is approved by the security team in my company. Anyway, could you please guide me through the installation process?

Hi

We would need some time to prepare a build, as it is not something that is already implemented.

Have you tried to run VS without Admin privileges? Did it work or did you encounter the same problem?

Hi,
Sorry, didn’t mention it. Unfortunately, due to some company policies, I am not able to run VS without Admin. I tried all possibilities and it always starts as an Admin.

Hi, this is a custom build with extra logging around User Identity Cirrus CI
You should be able to download the .vsix from the binaries tab.

You can share the full log in a direct message with me once you try to add a server connection again

Also, could you try adding Generic Credentials using Windows’ Credential Manger? It doesn’t matter what the actual value is, just check if you’re able to add something

1 Like

Hi,
Can I send you extended logs via the private message?

I can add entries in the Credential Manager successfully.

Hi, I’ve sent you a DM