{"record":{"id":"59b22022342d2f6a","repo":"clockworklabs/SpacetimeDB","slug":"error-59b220","errorCode":null,"errorMessage":"{error}","messagePattern":"\\{error\\}","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/tasks/csharp.rs","lineNumber":212,"sourceCode":"\n    let native_aot_flag = native_aot;\n\n    let project_global_json = find_global_json(project_path);\n    let cwd = std::env::current_dir()?;\n    let cwd_global_json = find_global_json(&cwd);\n    let dotnet_version_result = if project_global_json.is_some() {\n        Some(dotnet!(\"--version\").read())\n    } else if cwd_global_json.is_some() {\n        Some(duct::cmd!(\"dotnet\", \"--version\").read())\n    } else {\n        None\n    };\n    let dotnet_version_str = match dotnet_version_result {\n        Some(Ok(v)) => Some(v),\n        Some(Err(error)) if error.kind() == std::io::ErrorKind::NotFound => {\n            anyhow::bail!(\"dotnet not found in PATH. Please install .NET SDK 8.0 or 10.0.\")\n        }\n        Some(Err(error)) => anyhow::bail!(\"{error}\"),\n        None => None,\n    };\n\n    // Resolution order:\n    //   1. --dotnet-version CLI flag (explicit user override)\n    //   2. global.json-selected SDK, if one applies to the project or current directory\n    //   3. Single <TargetFramework> in the project's .csproj\n    //   4. .NET 10 default for missing or multi-target project context\n    let csproj_tfms = read_tfms_from_csproj(project_path);\n    let dotnet_major = dotnet_version_override\n        .or_else(|| dotnet_version_str.as_deref().and_then(parse_major_version))\n        .or_else(|| csproj_tfms.as_ref().and_then(CsprojTargetFrameworks::single_major))\n        .or(Some(10));\n\n    // Determine the build path based on SDK version and --native-aot flag.\n    let build_path = match (dotnet_major, native_aot_flag) {\n        // .NET 10: always use NativeAOT-LLVM, no flag needed.\n        (Some(10), _) => {","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/9e0d92412ff2248f401a8ad12d535f2b5ac30912/crates/cli/src/tasks/csharp.rs#L194-L230","documentation":"Same `dotnet --version` probe as the 'dotnet not found' error, but the failure is an OS error whose kind is not NotFound -- the raw io::Error is re-thrown verbatim. This includes permission/exec-format problems spawning dotnet and, via duct, non-zero exits of `dotnet --version` itself (the error string carries dotnet's stderr).","triggerScenarios":"`spacetime build` on a C# project with a global.json where dotnet exists but `dotnet --version` fails: a global.json pinning an SDK version that is not installed (dotnet exits non-zero with NETSDK1056-style errors), a non-executable or wrong-architecture binary, or a corrupt install.","commonSituations":"Repo-level global.json pinning e.g. 8.0.100 while only SDK 9/10 is installed; dotnet installed for a different CPU arch; sandboxed CI denying exec; partially upgraded SDKs.","solutions":["Run `dotnet --version` yourself in the same directory -- you will see the identical failure the CLI is surfacing.","If it is a global.json pin mismatch, install the pinned SDK or update global.json to one you have.","Fix the underlying cause: reinstall the SDK, ensure the binary is executable and matches your architecture.","If global.json is not needed, delete it -- the version probe is skipped and the SDK is chosen from the csproj or --dotnet-version."],"exampleFix":"// before: global.json pins an SDK you don't have\n{\"sdk\":{\"version\":\"8.0.100\"}}\n// after: roll forward to whatever 8.0.x is installed\n{\"sdk\":{\"version\":\"8.0.100\",\"rollForward\":\"latestFeature\"}}","handlingStrategy":"try-catch","validationCode":"# Pre-flight the exact probe the CLI performs, in the project directory\ncd \"$PROJECT_DIR\" && dotnet --version || { echo \"dotnet probe failed; fix SDK/global.json\" >&2; exit 1; }\nspacetime build","typeGuard":null,"tryCatchPattern":"out=$(spacetime build 2>&1); status=$?\nif [ $status -ne 0 ]; then\n  echo \"$out\" | tail -5   # the raw io::Error / dotnet stderr is embedded verbatim\n  dotnet --version         # reproduce to get the full underlying error\nfi","preventionTips":["Keep global.json pins aligned with installed SDKs (use rollForward: latestFeature/latestMinor).","Run `dotnet --version` in the project directory after any SDK upgrade.","Remove unneeded global.json files -- the CLI skips the probe entirely without one."],"tags":["csharp","dotnet","subprocess","toolchain","global-json"],"backgroundTag":"subprocess-execution-failed","analyzedSha":"9e0d92412ff2248f401a8ad12d535f2b5ac30912","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}