Operating system: Windows 10 Pro, 22H2, 19045.5011
Visual Studio version: Community 2022, 17.11.5
SonarLint plugin version: 8.6.0.10679
Programming language you’re coding in: C#
Is connected mode used: No
When opening a C# file, Visual Studio’s status bar shows the message “SonarLint: Failed to analyze file.cs. See the Output Window for more information”. The “SonarLint” output in the output window shows these messages:
[SLCoreAnalyzer] Analyzing xxx\file.cs with id
[SLCoreAnalyzer] Failed to analyze xxx\file.cs with id : StreamJsonRpc.RemoteInvocationException: Value cannot be null.
Parameter name: path1
at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__154`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.SLCore.Analysis.SLCoreAnalyzer.<ExecuteAnalysisInternalAsync>d__7.MoveNext()
RPC server exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: path1
at System.IO.Path.Combine(String path1, String path2)
at SonarLint.VisualStudio.Integration.SolutionWorkspaceService.<>c__DisplayClass9_0.<AllItemsInProject>b__0(VSITEMID id)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.ToHashSet[TSource](IEnumerable`1 source, IEqualityComparer`1 comparer)
at SonarLint.VisualStudio.Integration.SolutionWorkspaceService.<>c__DisplayClass7_0.<GetAllFilesInSolution>b__0()
at SonarLint.VisualStudio.Infrastructure.VS.ThreadHandling.<>c__DisplayClass5_0.<<RunOnUIThread>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 Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
at SonarLint.VisualStudio.Infrastructure.VS.ThreadHandling.RunOnUIThread(Action op)
at SonarLint.VisualStudio.Integration.SolutionWorkspaceService.GetAllFilesInSolution(IVsSolution solution)
at SonarLint.VisualStudio.SLCore.Listeners.Implementation.ListFilesListener.ListFilesAsync(ListFilesParams parameters)
It seems to happen with any file, with or without errors. The SonarLint analysis warnings/suggestions/etc for the file still appear, though. I’m not 100% sure of this, but it seems to only happen on projects for the Unity game engine, as I haven’t been able to reproduce it on other types of projects.
The errors you’re encountering are related to the SonarLint out-of-process service, which handles the analysis for all languages except C#, VB, C, and C++. This is why you are still able to see SonarLint issues for C#, as its analysis remains unaffected. However, these errors are unexpected, and we’d appreciate your assistance in diagnosing the cause so we can work on a resolution.
If possible, could you please share the full Verbose logs with us? You can find the instructions for obtaining these logs here: SonarLint Troubleshooting Guide.
Additionally, any further details about your project setup would be very helpful. For instance, have you opened the project as a solution, or is it set up as a folder/workspace?
The project is opened as a solution. I’m not sure if it’s relevant, but it’s a Unity project, which means Unity creates and updates the solution and project files. At first I thought it could have something to do with it being a Unity project somehow, because it happened with a pair of them and not other types of projects, but I have just checked with another Unity project and it doesn’t happen on it.
This is the log, just after opening the project, with one file opened at the start:
[ThreadId 1] [DEBUG] [ConnectedMode/GitMonitor] Monitoring git repo. Root path: H:\PathPart1\PathPart2\Project Name
[ThreadId 22] [FileTracker] Service Provider is unavailable
[ThreadId 26] [DEBUG] [ExclusionSettingsStorage] Standalone mode, exclusions are not supported.
[ThreadId 26] [DEBUG] [AnalyzableFileIndicator] No server settings were found.
[ThreadId 26] [SLCoreAnalyzer] Analyzing H:\PathPart1\PathPart2\Project Name\Assets\Test.cs with id
[ThreadId 26] [SLCoreAnalyzer] Analysis not ready for file H:\PathPart1\PathPart2\Project Name\Assets\Test.cs: Configuration scope not initialized
[ThreadId 1] Initializing the telemetry package...
[ThreadId 1] Finished initializing the telemetry package...
[ThreadId 1] Initializing the SonarLint package...
[ThreadId 1] Finishing initializing the SonarLint package
[ThreadId 83] Initializing the notifications package...
[ThreadId 1] Not connected: not checking for notifications
[ThreadId 1] Finished initializing the notifications package
[ThreadId 1] [SharedBindingConfigProvider] SonarLint shared folder was not found
[ThreadId 92] Initializing the daemon package...
[ThreadId 92] [Connection Migration] Start migrating connections from existing bindings
[ThreadId 92] [Connection Migration] End migrating connections from existing bindings
[ThreadId 32] [SLCoreHandler] Creating SLCore instance
[ThreadId 32] [SLCoreHandler] Starting SLCore instance
[ThreadId 32] Loaded settings from "C:\Users\trisi\AppData\Roaming\SonarLint for Visual Studio\settings.json".
[ThreadId 1] Current VS version:
Visual Studio Community 2022
17.11.35327.3
17.11.5
[ThreadId 32] [NodeJSLocator] Checking environment variable SONAR_NODEJS_PATH
[ThreadId 32] [NodeJsLocator] Environment variable is not set
[ThreadId 32] Finished initializing the daemon package.
[ThreadId 54] [DEBUG] [SLCORE] SonarLint backend started, instance=org.sonarsource.sonarlint.core.rpc.impl.SonarLintRpcServerImpl@cb0755b
[ThreadId 44] [DEBUG] [SLCORE] Started embedded server on port 64120
[ThreadId 13] [DEBUG] [SLCORE] Restoring previous local-only issue database from C:\Users\trisi\AppData\Local\SLVS_SLOOP\storageRoot\local_only_issue_backup.tar.gz
[ThreadId 51] [DEBUG] [SLCORE] Starting local-only issue database from C:\Users\trisi\.sonarlint\xodus-local-only-issue-store13328066781943776530
[ThreadId 23] [SLCORE] Can't open directory channel. Log directory fsync won't be performed.
[ThreadId 52] [SLCORE] Unexpected error occurred in scheduled task
[ThreadId 52] [DEBUG] [SLCORE] Synchronizing new configuration scopes: [Project Name]
[ThreadId 7] [DEBUG] [SLCORE] Looking for node in the PATH
[ThreadId 53] [DEBUG] [SLCORE] Execute command 'C:\Windows\System32\where.exe $PATH:node.exe'...
[ThreadId 7] [DEBUG] [SLCORE] Command 'C:\Windows\System32\where.exe $PATH:node.exe' exited with 1
stderr: INFO: Could not find files for the given pattern(s).
[ThreadId 7] [DEBUG] [SLCORE] Unable to locate node
[ThreadId 7] [SLCORE] Node.js could not be automatically detected, has to be configured manually in the SonarLint preferences!
[ThreadId 7] [DEBUG] [SLCORE] Plugin 'JavaScript/TypeScript/CSS Code Quality and Security' requires Node.js 18.17.0. Skip loading it.
[ThreadId 7] [DEBUG] [SLCORE] Loaded 4 plugins
[ThreadId 7] [DEBUG] [SLCORE] * CFamily Code Quality and Security 6.59.0.75237 (cpp)
[ThreadId 7] [DEBUG] [SLCORE] * C# Code Quality and Security 9.32.0.97167 (csharp)
[ThreadId 7] [DEBUG] [SLCORE] * Text Code Quality and Security 2.16.0.4008 (text)
[ThreadId 7] [DEBUG] [SLCORE] * VB.NET Code Quality and Security 9.32.0.97167 (vbnet)
[ThreadId 7] [DEBUG] [SLCORE] Creating container for module 'Project Name'
[ThreadId 7] Updated analysis readiness: True
[ThreadId 38] Starting job: "re-analyzing 1 document(s)...". Time: 16:57:12
[ThreadId 38] Finished job "re-analyzing 1 document(s)..." started at 16:57:12. Elapsed time: 6ms
[ThreadId 14] [DEBUG] [ExclusionSettingsStorage] Standalone mode, exclusions are not supported.
[ThreadId 14] [DEBUG] [AnalyzableFileIndicator] No server settings were found.
[ThreadId 14] [SLCoreAnalyzer] Analyzing H:\PathPart1\PathPart2\Project Name\Assets\Test.cs with id
[ThreadId 10] [DEBUG] [SLCORE] Extracting standalone rules metadata
[ThreadId 14] [DEBUG] [SLCORE] Computing file exclusion for uri 'file:///H:/PathPart1/PathPart2/Project%20Name/Assets/Test.cs'
[ThreadId 14] [DEBUG] [SLCORE] Unable to find client file for uri file:///H:/PathPart1/PathPart2/Project%20Name/Assets/Test.cs
[ThreadId 14] [DEBUG] [SLCORE] Relativizing path: H:\PathPart1\PathPart2\Project Name\Assets\Test.cs for git repo Assets
[ThreadId 28] [SLCoreAnalyzer] Failed to analyze H:\PathPart1\PathPart2\Project Name\Assets\Test.cs with id : StreamJsonRpc.RemoteInvocationException: Value cannot be null.
Parameter name: path1
at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__154`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.SLCore.Analysis.SLCoreAnalyzer.<ExecuteAnalysisInternalAsync>d__7.MoveNext()
RPC server exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: path1
at System.IO.Path.Combine(String path1, String path2)
at SonarLint.VisualStudio.Integration.SolutionWorkspaceService.<>c__DisplayClass9_0.<AllItemsInProject>b__0(VSITEMID id)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.ToHashSet[TSource](IEnumerable`1 source, IEqualityComparer`1 comparer)
at SonarLint.VisualStudio.Integration.SolutionWorkspaceService.<>c__DisplayClass7_0.<GetAllFilesInSolution>b__0()
at SonarLint.VisualStudio.Infrastructure.VS.ThreadHandling.<>c__DisplayClass5_0.<<RunOnUIThread>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 Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
at SonarLint.VisualStudio.Infrastructure.VS.ThreadHandling.RunOnUIThread(Action op)
at SonarLint.VisualStudio.Integration.SolutionWorkspaceService.GetAllFilesInSolution(IVsSolution solution)
at SonarLint.VisualStudio.SLCore.Listeners.Implementation.ListFilesListener.ListFilesAsync(ListFilesParams parameters)
I have checked with the Unity project in which the issue doesn’t happen, and the main difference apart from the errors seems to be the line [SLCORE] Unexpected error occurred in scheduled task, which in the project without the issue is [DEBUG] [SLCORE] No connections configured, skipping binding suggestions.. This is the full log:
[ThreadId 1] [DEBUG] [ConnectedMode/GitMonitor] Monitoring git repo. Root path: H:\PathPart1\PathPart2\Project Name
[ThreadId 55] [FileTracker] Service Provider is unavailable
[ThreadId 54] [DEBUG] [ExclusionSettingsStorage] Standalone mode, exclusions are not supported.
[ThreadId 54] [DEBUG] [AnalyzableFileIndicator] No server settings were found.
[ThreadId 54] [SLCoreAnalyzer] Analyzing H:\PathPart1\PathPart2\Project Name\Assets\Test.cs with id
[ThreadId 54] [SLCoreAnalyzer] Analysis not ready for file H:\PathPart1\PathPart2\Project Name\Assets\Test.cs: Configuration scope not initialized
[ThreadId 1] Initializing the telemetry package...
[ThreadId 1] Finished initializing the telemetry package...
[ThreadId 1] Initializing the SonarLint package...
[ThreadId 1] Finishing initializing the SonarLint package
[ThreadId 86] Initializing the notifications package...
[ThreadId 1] Not connected: not checking for notifications
[ThreadId 1] Finished initializing the notifications package
[ThreadId 1] [SharedBindingConfigProvider] SonarLint shared folder was not found
[ThreadId 102] Initializing the daemon package...
[ThreadId 102] [Connection Migration] Start migrating connections from existing bindings
[ThreadId 102] [Connection Migration] End migrating connections from existing bindings
[ThreadId 30] [SLCoreHandler] Creating SLCore instance
[ThreadId 30] [SLCoreHandler] Starting SLCore instance
[ThreadId 30] Loaded settings from "C:\Users\trisi\AppData\Roaming\SonarLint for Visual Studio\settings.json".
[ThreadId 1] Current VS version:
Visual Studio Community 2022
17.11.35327.3
17.11.5
[ThreadId 30] [NodeJSLocator] Checking environment variable SONAR_NODEJS_PATH
[ThreadId 30] [NodeJsLocator] Environment variable is not set
[ThreadId 30] Finished initializing the daemon package.
[ThreadId 49] [DEBUG] [SLCORE] SonarLint backend started, instance=org.sonarsource.sonarlint.core.rpc.impl.SonarLintRpcServerImpl@cb0755b
[ThreadId 56] [DEBUG] [SLCORE] Started embedded server on port 64120
[ThreadId 37] [DEBUG] [SLCORE] Restoring previous local-only issue database from C:\Users\trisi\AppData\Local\SLVS_SLOOP\storageRoot\local_only_issue_backup.tar.gz
[ThreadId 45] [DEBUG] [SLCORE] Starting local-only issue database from C:\Users\trisi\.sonarlint\xodus-local-only-issue-store15866362078860775608
[ThreadId 10] [SLCORE] Can't open directory channel. Log directory fsync won't be performed.
[ThreadId 16] [DEBUG] [SLCORE] No connections configured, skipping binding suggestions.
[ThreadId 16] [DEBUG] [SLCORE] Synchronizing new configuration scopes: [Project Name]
[ThreadId 37] [DEBUG] [SLCORE] Looking for node in the PATH
[ThreadId 53] [DEBUG] [SLCORE] Execute command 'C:\Windows\System32\where.exe $PATH:node.exe'...
[ThreadId 37] [DEBUG] [SLCORE] Command 'C:\Windows\System32\where.exe $PATH:node.exe' exited with 1
stderr: INFO: Could not find files for the given pattern(s).
[ThreadId 37] [DEBUG] [SLCORE] Unable to locate node
[ThreadId 37] [SLCORE] Node.js could not be automatically detected, has to be configured manually in the SonarLint preferences!
[ThreadId 39] [DEBUG] [SLCORE] Plugin 'JavaScript/TypeScript/CSS Code Quality and Security' requires Node.js 18.17.0. Skip loading it.
[ThreadId 10] [DEBUG] [SLCORE] Loaded 4 plugins
[ThreadId 10] [DEBUG] [SLCORE] * CFamily Code Quality and Security 6.59.0.75237 (cpp)
[ThreadId 10] [DEBUG] [SLCORE] * C# Code Quality and Security 9.32.0.97167 (csharp)
[ThreadId 10] [DEBUG] [SLCORE] * Text Code Quality and Security 2.16.0.4008 (text)
[ThreadId 10] [DEBUG] [SLCORE] * VB.NET Code Quality and Security 9.32.0.97167 (vbnet)
[ThreadId 39] [DEBUG] [SLCORE] Creating container for module 'Project Name'
[ThreadId 53] Updated analysis readiness: True
[ThreadId 55] Starting job: "re-analyzing 1 document(s)...". Time: 17:20:49
[ThreadId 55] Finished job "re-analyzing 1 document(s)..." started at 17:20:49. Elapsed time: 7ms
[ThreadId 53] [DEBUG] [ExclusionSettingsStorage] Standalone mode, exclusions are not supported.
[ThreadId 53] [DEBUG] [AnalyzableFileIndicator] No server settings were found.
[ThreadId 53] [SLCoreAnalyzer] Analyzing H:\PathPart1\PathPart2\Project Name\Assets\Test.cs with id
[ThreadId 18] [DEBUG] [SLCORE] Language of file "file:///H:/PathPart1/PathPart2/Project%20Name/Assets/Test.cs" is detected to be "CS"
[ThreadId 16] [DEBUG] [SLCORE] Computing file exclusion for uri 'file:///H:/PathPart1/PathPart2/Project%20Name/Assets/Test.cs'
[ThreadId 10] [DEBUG] [SLCORE] Extracting standalone rules metadata
[ThreadId 28] [DEBUG] [SLCORE] Relativizing path: H:\PathPart1\PathPart2\Project Name\Assets\Test.cs for git repo Assets
[ThreadId 28] [DEBUG] [SLCORE] Triggering analysis with configuration: [
baseDir: H:\PathPart1\PathPart2\Project Name\Assets
extraProperties: {}
activeRules: [425 cpp, 189 c, 90 secrets]
inputFiles: [
file:///H:/PathPart1/PathPart2/Project%20Name/Assets/Test.cs (UTF-8)
]
]
[ThreadId 28] [DEBUG] [SLCORE] Restoring previous known findings database from C:\Users\trisi\AppData\Local\SLVS_SLOOP\storageRoot\known_findings_backup.tar.gz
[ThreadId 28] [DEBUG] [SLCORE] Starting known findings database from C:\Users\trisi\.sonarlint\known-findings-store958034014655703530
[ThreadId 31] [DEBUG] [SLCORE] Start analysis
[ThreadId 9] [DEBUG] [SLCORE] Index files
[ThreadId 9] [DEBUG] [SLCORE] Language of file "file:///H:/PathPart1/PathPart2/Project%20Name/Assets/Test.cs" is detected to be "CS"
[ThreadId 52] [DEBUG] [SLCORE] 1 file indexed
[ThreadId 13] [DEBUG] [SLCORE] Execute Sensor: TextAndSecretsSensor
[ThreadId 13] [DEBUG] [SLCORE] Available processors: 20
[ThreadId 13] [DEBUG] [SLCORE] Using 20 threads for analysis.
[ThreadId 52] [DEBUG] [SLCORE] The property "sonar.tests" is not set. To improve the analysis accuracy, we categorize a file as a test file if any of the following is true:
* The filename starts with "test"
* The filename contains "test." or "tests."
* Any directory in the file path is named: "doc", "docs", "test" or "tests"
* Any directory in the file path has a name ending in "test" or "tests"
[ThreadId 31] [DEBUG] [SLCORE] Analyzing all except non binary files
[ThreadId 9] [DEBUG] [SLCORE] 1 source file to be analyzed
[ThreadId 36] [DEBUG] [SLCORE] 1/1 source file has been analyzed
[ThreadId 15] [DEBUG] [SLCORE] Analysis detected 0 issues and 0 Security Hotspots in 1254ms
[ThreadId 13] [DEBUG] [SLCORE] Matching Sonar project branch
[ThreadId 13] [DEBUG] [SLCORE] No binding for configuration scope
[ThreadId 13] [DEBUG] [SLCORE] Computing paths translation for config scope 'Project Name'...
[ThreadId 13] [DEBUG] [SLCORE] Config scope 'Project Name' does not exist or is not bound
[ThreadId 52] [SLCoreAnalyzer] Finished analyzing H:\PathPart1\PathPart2\Project Name\Assets\Test.cs with id e8060965-ae65-4047-ac25-5b9c6bee1732, analysis time: 0s
[ThreadId 52] [SLCoreAnalyzer] Found 0 issue(s) for H:\PathPart1\PathPart2\Project Name\Assets\Test.cs