You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
C# sidecar silently drops analyzers it cannot load (e.g. built against a newer Roslyn) #495
The C# sidecar silently drops any analyzer it cannot load. AnalyzerDiagnosticResolver.DiscoverDocumentAnalyzers (src/sidecars/SharpLsp.Sidecar.CSharp/Workspace/AnalyzerDiagnosticResolver.cs) calls GetAnalyzers(LanguageNames.CSharp) on every analyzer reference. Roslyn returns no analyzers from an assembly it refuses to load, and nothing records why. The most common cause is an analyzer built against a newer Roslyn than the sidecar hosts. The sidecar ships Roslyn 5.6.0, matching the pinned SDK 10.0.303, while SDK 10.0.4xx ships Roslyn 5.9.0.
The user then sees none of that analyzer's diagnostics in the editor. Nothing explains why, though dotnet build reports them, and there is no log line either. The repository's logging rules forbid silent failures.
Found by
CI on #494: the Linux runner's newest SDK is 10.0.401. A test fixture built its cooperative analyzer against that SDK, so the sidecar loaded nothing. The fixture is now pinned to the repository's SDK, but a user's own analyzers have no such pin.
Expected
When an analyzer reference cannot load (AnalyzerFileReference.AnalyzerLoadFailed: ReferencesNewerCompiler, UnableToLoadAnalyzer, UnableToCreateAnalyzer, NoAnalyzers), the sidecar should do two things:
Log a structured warning naming the analyzer assembly, the failure kind and the compiler versions involved.
Surface the failure to the user. One option is a project-level diagnostic, matching what the SDK's build reports as CS8032/CS9057.
Test
Load a project that references an analyzer assembly the sidecar cannot load, such as one compiled against a newer Microsoft.CodeAnalysis, or an invalid assembly.
Assert the warning is logged and the failure is reported, never an empty, clean result.
Activity
Report analyzers the C# sidecar cannot load; recover exception messag…
Report analyzers the C# sidecar cannot load instead of dropping them