If I have no files open, also when I build, nothing happens.
Once I open a file I get this message popping op:
Feature ‘Diagnostic analyzer runner’ is currently unavailable due to an internal error. Show Stack Trace
The StackTrace
StreamJsonRpc.RemoteInvocationException: Argument contains an analyzer instance that does not belong to the 'Analyzers' for this CompilationWithAnalyzers instance. (Parameter '_analyzers')
at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__156`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 Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.<TryInvokeAsync>d__18`1.MoveNext()
RPC server exception:
System.ArgumentException: Argument contains an analyzer instance that does not belong to the 'Analyzers' for this CompilationWithAnalyzers instance. (Parameter '_analyzers')
at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.VerifyExistingAnalyzersArgument(ImmutableArray`1 analyzers)
at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalysisResultAsync(SyntaxTree tree, Nullable`1 filterSpan, ImmutableArray`1 analyzers, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzersPair.GetAnalysisResultAsync(SyntaxTree tree, Nullable`1 filterSpan, ImmutableArray`1 projectAnalyzers, ImmutableArray`1 hostAnalyzers, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, Project project, DiagnosticAnalyzerInfoCache analyzerInfoCache, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.Diagnostics.DiagnosticComputer.AnalyzeAsync(CompilationWithAnalyzersPair compilationWithAnalyzers, BidirectionalMap`2 analyzerToIdMap, ImmutableArray`1 projectAnalyzers, ImmutableArray`1 hostAnalyzers, SkippedHostAnalyzersInfo skippedAnalyzersInfo, Boolean reportSuppressedDiagnostics, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.Diagnostics.DiagnosticComputer.GetDiagnosticsAsync(ImmutableArray`1 projectAnalyzerIds, ImmutableArray`1 hostAnalyzerIds, Boolean reportSuppressedDiagnostics, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.Diagnostics.DiagnosticComputer.GetNormalPriorityDiagnosticsAsync(ImmutableArray`1 projectAnalyzerIds, ImmutableArray`1 hostAnalyzerIds, Boolean reportSuppressedDiagnostics, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteDiagnosticAnalyzerService.<>c__DisplayClass3_0.<<CalculateDiagnosticsAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.<>c__DisplayClass7_0`1.<<RunWithSolutionAsync>g__ProcessSolutionAsync|1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Boolean updatePrimaryBranch, Func`2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Boolean updatePrimaryBranch, Func`2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.RunWithSolutionAsync[T](Checksum solutionChecksum, Func`2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteDiagnosticAnalyzerService.CalculateDiagnosticsAsync(Checksum solutionChecksum, DiagnosticArguments arguments, CancellationToken cancellationToken)
It does not state anything about SonarQube IDE being the cause. Once I disable it, this does not longer occur. There are not file on a network. I have no custom Java installation, nor configured anything about Java. I have (as mentioned) VS2022 spelling check. Disabling that one did not change a thing (I assume they also hook on to Roslyn)
With verbose logging enabled, I get this:
Initializing the telemetry package...
Finished initializing the telemetry package...
Initializing the daemon package...
[Connection Migration] Start migrating connections from existing bindings
[Connection Migration] End migrating connections from existing bindings
[SLCoreHandler] Creating SLCore instance
[SLCoreHandler] Starting SLCore instance
Settings file does not exist at "C:\Users\c.nobel\AppData\Roaming\SonarLint for Visual Studio\settings.json".
Default settings will be used
Current VS version:
Visual Studio Enterprise 2022
17.12.35707.178
17.12.4
[NodeJSLocator] Checking environment variable SONAR_NODEJS_PATH
[NodeJsLocator] Environment variable is not set
Finished initializing the daemon package.
Initializing the SonarQube for Visual Studio package...
Finishing initializing the SonarQube for Visual Studio package
Initializing the notifications package...
Not connected: not checking for notifications
Finished initializing the notifications package
[SharedBindingConfigProvider] The .sonarlint shared folder was not found
[SLCore] Can't open directory channel. Log directory fsync won't be performed.
Updated analysis readiness: True
Starting job: "re-analyzing 0 document(s)...". Time: 10:37:26
Finished job "re-analyzing 0 document(s)..." started at 10:37:26. Elapsed time: 2ms
Saving notifications settings...
[SLCoreAnalyzer] Analyzing C:\code\dotnet-project-file-analyzers\src\DotNetProjectFile.Analyzers\Rule.cs with id f01a0d25-1356-4e82-ba6c-6767bf73446d
[SLCoreAnalyzer] Found 0 issue(s) in C:\code\dotnet-project-file-analyzers\src\DotNetProjectFile.Analyzers\Rule.cs [id: f01a0d25-1356-4e82-ba6c-6767bf73446d, final: True]
[SLCoreAnalyzer] Finished analyzing C:\code\dotnet-project-file-analyzers\src\DotNetProjectFile.Analyzers\Rule.cs with id f01a0d25-1356-4e82-ba6c-6767bf73446d, analysis time: 3,24s
Saving notifications settings...
Saving notifications settings...
[SLCoreAnalyzer] Analyzing C:\code\dotnet-project-file-analyzers\src\DotNetProjectFile.Analyzers\Rule.Ini.cs with id 6765d352-55d2-4646-aa80-e4c439949fc5
[SLCoreAnalyzer] Found 0 issue(s) in C:\code\dotnet-project-file-analyzers\src\DotNetProjectFile.Analyzers\Rule.Ini.cs [id: 6765d352-55d2-4646-aa80-e4c439949fc5, final: True]
[SLCoreAnalyzer] Finished analyzing C:\code\dotnet-project-file-analyzers\src\DotNetProjectFile.Analyzers\Rule.Ini.cs with id 6765d352-55d2-4646-aa80-e4c439949fc5, analysis time: 0,126s
[ThreadId 1] Saving notifications settings...
[ThreadId 15] [SLCoreAnalyzer] Analyzing C:\code\dotnet-project-file-analyzers\specs\Benchmarks\Program.cs with id 06aaff42-a782-4be2-ae4b-5d7f202547a3
[DEBUG] [ThreadId 303] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Language of file "file:///C:/code/dotnet-project-file-analyzers/specs/Benchmarks/Program.cs" is detected to be "CS"
[DEBUG] [ThreadId 303] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Processing file event C:/code/dotnet-project-file-analyzers/specs/Benchmarks/Program.cs with event MODIFIED
[DEBUG] [ThreadId 303] [SLCore] [sonarlint > sonarlint-file-exclusions] Computing file exclusion for uri 'file:///C:/code/dotnet-project-file-analyzers/specs/Benchmarks/Program.cs'
[DEBUG] [ThreadId 302] [SLCore] [sonarlint > dotnet-project-file-analyzers > SonarLint Server RPC request executor] Triggering analysis with configuration: [
baseDir: C:\code\dotnet-project-file-analyzers\specs\Benchmarks
extraProperties: {}
activeRules: [429 cpp, 24 css, 189 c, 46 Web, 315 csharpsquid, 267 typescript, 143 vbnet, 29 secrets, 265 javascript]
inputFiles: [
file:///C:/code/dotnet-project-file-analyzers/specs/Benchmarks/Program.cs (UTF-8)
]
]
[DEBUG] [ThreadId 299] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Start analysis
[DEBUG] [ThreadId 300] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Index files
[DEBUG] [ThreadId 300] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Language of file "file:///C:/code/dotnet-project-file-analyzers/specs/Benchmarks/Program.cs" is detected to be "CS"
[DEBUG] [ThreadId 300] [SLCore] [sonarlint > dotnet-project-file-analyzers > Report about progress of file indexation] 1 file indexed
[DEBUG] [ThreadId 253] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Added 267 checks for language='ts', repository='typescript'
[DEBUG] [ThreadId 253] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Added 265 checks for language='js', repository='javascript'
[DEBUG] [ThreadId 310] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] No registered JsAnalysisConsumer.
[DEBUG] [ThreadId 238] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Execute Sensor: HTML
[DEBUG] [ThreadId 238] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] 'JavaScript/TypeScript analysis' skipped because there are no related files in the current project
[DEBUG] [ThreadId 238] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] 'JavaScript inside YAML analysis' skipped because there are no related files in the current project
[DEBUG] [ThreadId 238] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] 'JavaScript inside HTML analysis' skipped because there are no related files in the current project
[DEBUG] [ThreadId 238] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Execute Sensor: CSS Rules
[DEBUG] [ThreadId 238] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
[DEBUG] [ThreadId 238] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] 'CFamily' skipped because there are no related files in the current project
[DEBUG] [ThreadId 238] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Execute Sensor: TextAndSecretsSensor
[DEBUG] [ThreadId 238] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Available processors: 20
[DEBUG] [ThreadId 238] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Using 20 threads for analysis.
[DEBUG] [ThreadId 191] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Analyzing all except non binary files
[DEBUG] [ThreadId 201] [SLCore] [sonarlint > dotnet-project-file-analyzers > Progress of the text and secrets analysis] 1 source file to be analyzed
[DEBUG] [ThreadId 298] [SLCore] [sonarlint > dotnet-project-file-analyzers > Progress of the text and secrets analysis] 1/1 source file has been analyzed
[DEBUG] [ThreadId 298] [SLCore] [sonarlint > dotnet-project-file-analyzers > sonarlint-analysis-engine] Analysis detected 0 issues and 0 Security Hotspots in 70ms
[ThreadId 298] [SLCoreAnalyzer] Found 0 issue(s) in C:\code\dotnet-project-file-analyzers\specs\Benchmarks\Program.cs [id: 06aaff42-a782-4be2-ae4b-5d7f202547a3, final: True]
[ThreadId 201] [SLCoreAnalyzer] Finished analyzing C:\code\dotnet-project-file-analyzers\specs\Benchmarks\Program.cs with id 06aaff42-a782-4be2-ae4b-5d7f202547a3, analysis time: 0,11s
The most tricky part that I can think of, is that this project contains analyzers on top of Roslyn that analyze additional files (like MS Build project files). But if you can not reproduce it building this project, something else might be at going in. If you need more info, just let me know.