{"record":{"id":"f97c0e9a2329803c","repo":"oraios/serena","slug":"no-sln-file-found-in-repository","errorCode":null,"errorMessage":"No SLN file found in repository","messagePattern":"No SLN file found in repository","errorType":"exception","errorClass":"SolidLSPException","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/omnisharp.py","lineNumber":83,"sourceCode":"class OmniSharp(SolidLanguageServer):\n    \"\"\"\n    Provides C# specific instantiation of the LanguageServer class. Contains various configurations and settings specific to C#.\n\n    You can pass the following entries in ``ls_specific_settings[\"csharp_omnisharp\"]``:\n        - omnisharp_version: Override the pinned OmniSharp version downloaded by Serena.\n        - razor_omnisharp_version: Override the pinned Razor plugin version downloaded by Serena.\n    \"\"\"\n\n    def __init__(self, config: LanguageServerConfig, repository_root_path: str, solidlsp_settings: SolidLSPSettings):\n        \"\"\"\n        Creates an OmniSharp instance. This class is not meant to be instantiated directly. Use LanguageServer.create() instead.\n        \"\"\"\n        omnisharp_executable_path, dll_path = self._setup_runtime_dependencies(config, solidlsp_settings)\n\n        slnfilename = find_least_depth_sln_file(repository_root_path)\n        if slnfilename is None:\n            log.error(\"No *.sln file found in repository\")\n            raise SolidLSPException(\"No SLN file found in repository\")\n\n        cmd = \" \".join(\n            [\n                omnisharp_executable_path,\n                \"-lsp\",\n                \"--encoding\",\n                \"ascii\",\n                \"-z\",\n                \"-s\",\n                f'\"{slnfilename}\"',\n                \"--hostPID\",\n                str(os.getpid()),\n                \"DotNet:enablePackageRestore=false\",\n                \"--loglevel\",\n                \"trace\",\n                \"--plugin\",\n                dll_path,\n                \"FileOptions:SystemExcludeSearchPatterns:0=**/.git\",","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/omnisharp.py#L65-L101","documentation":"Raised by OmniSharp's __init__ when find_least_depth_sln_file() finds no *.sln file in the repository root tree. OmniSharp needs a Visual Studio solution file to initialize a C# workspace, so the server refuses to start without one.","triggerScenarios":"Instantiating the OmniSharp-based C# SolidLSP server against a repository that contains no .sln file at any depth under repository_root_path.","commonSituations":"SDK-style projects using only .csproj files without a solution; dotnet new console projects with no sln; repo where the .sln lives outside repository_root_path; solutions stored with non-standard extension or generated at build time.","solutions":["Create a solution in the repo root: `dotnet new sln` then `dotnet sln add <Project>.csproj`.","If a .sln exists elsewhere, ensure repository_root_path passed to the server contains it (point the server at the directory holding the sln).","Add the existing solution: `dotnet sln add path/to/Existing.sln` won't merge — instead commit the sln or nest the project under the repo directory containing it.","Verify with `find . -name '*.sln'` that at least one solution file is present before initializing."],"exampleFix":"// before (shell, project without solution)\ncd repo && python -m app  # No SLN file found\n// after\ncd repo\ndotnet new sln -n MyRepo\ndotnet sln add src/MyApp/MyApp.csproj\npython -m app","handlingStrategy":"validation","validationCode":"from pathlib import Path\ndef has_sln(repo_root):\n    return any(Path(repo_root).rglob(\"*.sln\"))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit a .sln to the repo root or ensure one exists before initializing OmniSharp","Generate it in CI: `dotnet new sln && dotnet sln add **/*.csproj`","Point the server's repository_root_path at the directory containing the solution","Avoid solutionless setups — create the sln at project bootstrap"],"tags":["csharp","omnisharp","missing-file","configuration"],"backgroundTag":"missing-solution-file","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}