{"record":{"id":"536e5f56bf79e1c1","repo":"oraios/serena","slug":"failed-to-start-c-language-server-e","errorCode":null,"errorMessage":"Failed to start C# language server: {e}","messagePattern":"Failed to start C# language server: (.+?)","errorType":"exception","errorClass":"SolidLSPException","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/csharp_language_server.py","lineNumber":663,"sourceCode":"            indexing_complete.set()\n\n        # Set up notification handlers\n        self.server.on_notification(\"window/logMessage\", window_log_message)\n        self.server.on_notification(\"$/progress\", handle_progress)\n        self.server.on_notification(\"textDocument/publishDiagnostics\", do_nothing)\n        self.server.on_notification(\"workspace/projectInitializationComplete\", handle_workspace_indexing_complete)\n        self.server.on_request(\"workspace/configuration\", handle_workspace_configuration)\n        self.server.on_request(\"window/workDoneProgress/create\", handle_work_done_progress_create)\n        self.server.on_request(\"client/registerCapability\", handle_register_capability)\n        self.server.on_request(\"workspace/_roslyn_projectNeedsRestore\", handle_project_needs_restore)\n\n        log.info(\"Starting Microsoft.CodeAnalysis.LanguageServer process\")\n\n        try:\n            self.server.start()\n        except Exception as e:\n            log.info(f\"Failed to start language server process: {e}\", logging.ERROR)\n            raise SolidLSPException(f\"Failed to start C# language server: {e}\")\n\n        # Send initialization\n        initialize_params = self._create_initialize_params()\n\n        log.info(\"Sending initialize request to language server\")\n        try:\n            init_response = self.server.send.initialize(initialize_params)\n            log.info(f\"Received initialize response: {init_response}\")\n        except Exception as e:\n            raise SolidLSPException(f\"Failed to initialize C# language server for {self.repository_root_path}: {e}\") from e\n\n        # Apply diagnostic capabilities\n        self._force_pull_diagnostics(init_response)\n\n        # Verify required capabilities\n        capabilities = init_response.get(\"capabilities\", {})\n        required_capabilities = [\n            \"textDocumentSync\",","sourceCodeStart":645,"sourceCodeEnd":681,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/csharp_language_server.py#L645-L681","documentation":"Raised by _start_server when self.server.start() throws any exception while launching the Roslyn language server process; it wraps the underlying error in SolidLSPException. Commonly the DLL can't be launched (missing runtime, wrong architecture) or the process dies immediately.","triggerScenarios":"CSharpLanguageServer._start_server when LanguageServer.start() raises — e.g. the launch command can't execute (missing .NET runtime, bad DLL path), missing dependencies for the Roslyn server, or spawn permission errors.","commonSituations":".NET runtime not installed or too old for the Roslyn server version, executable bit not set (permission), Apple Silicon running x64-only build without Rosetta, or the server binary downloaded for the wrong OS.","solutions":["Check the logged inner message ('Failed to start language server process: {e}') for the root cause","Install/upgrade the .NET SDK/runtime to a version compatible with the Roslyn language server","Re-download the language server for the correct platform (clear cache dir and rerun)","Verify the DLL/executable is runnable manually: `dotnet <server_dll> --help` or executing the native binary directly"],"exampleFix":"// before\n$ dotnet --list-runtimes # (nothing installed)\n// after\nsudo apt-get install -y dotnet-sdk-9.0\n$ dotnet --list-runtimes # Microsoft.NETCore.App 9.x","handlingStrategy":"validation","validationCode":"import subprocess\nfrom pathlib import Path\n\ndef can_launch_roslyn(server_dll: str) -> tuple[bool, str]:\n    dll = Path(server_dll)\n    if not dll.is_file():\n        return False, \"DLL missing\"\n    try:\n        p = subprocess.run([\"dotnet\", \"--list-runtimes\"], capture_output=True, text=True, timeout=30)\n    except (OSError, subprocess.TimeoutExpired):\n        return False, \".NET runtime missing or not runnable\"\n    if p.returncode != 0 or \"Microsoft.NETCore.App\" not in p.stdout:\n        return False, \".NET runtime not installed\"\n    return True, p.stdout.splitlines()[0]\n","typeGuard":"def dotnet_runtime_available() -> bool:\n    import shutil\n    return shutil.which(\"dotnet\") is not None\n","tryCatchPattern":"try:\n    ls._start_server()\nexcept SolidLSPException as e:\n    log.error(f\"Roslyn start failed: {e}\")\n    ok, reason = can_launch_roslyn(server_dll)\n    if not ok:\n        install_dotnet_runtime()  # e.g. apt install dotnet-sdk-9.0\n        ls._start_server()\n    else:\n        raise\n","preventionTips":["Install the .NET SDK/runtime version required by the Roslyn language server before setup","Verify the downloaded server build matches your OS/architecture","Add a preflight `dotnet --list-runtimes` check to onboarding/CI scripts","Ensure the server DLL keeps its executable bit on Unix after cache copies"],"tags":["csharp","roslyn","process-start","dotnet"],"backgroundTag":"language-server-start-failed","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}