{"record":{"id":"d397195a20e4ff68","repo":"clockworklabs/SpacetimeDB","slug":"unsupported-net-sdk-version-major-spacetimedb","errorCode":null,"errorMessage":"Unsupported .NET SDK version: {major}. SpacetimeDB requires .NET SDK 8.0 or 10.0.","messagePattern":"Unsupported \\.NET SDK version: (.+?)\\. SpacetimeDB requires \\.NET SDK 8\\.0 or 10\\.0\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/tasks/csharp.rs","lineNumber":18,"sourceCode":"use anyhow::Context;\nuse itertools::Itertools;\nuse std::collections::HashSet;\nuse std::ffi::OsString;\nuse std::fs;\nuse std::path::{Path, PathBuf};\n\nuse crate::common_args::{nativeaot_unsupported_on_host, NATIVEAOT_UNSUPPORTED_MESSAGE};\n\npub(crate) fn parse_major_version(version: &str) -> Option<u8> {\n    version.split('.').next()?.parse::<u8>().ok()\n}\n\nfn dotnet_global_json(major: u8) -> anyhow::Result<String> {\n    match major {\n        8 => Ok(r#\"{\"sdk\":{\"version\":\"8.0.100\",\"rollForward\":\"latestFeature\"}}\"#.to_string()),\n        10 => Ok(r#\"{\"sdk\":{\"version\":\"10.0.100\",\"rollForward\":\"latestMinor\"}}\"#.to_string()),\n        _ => anyhow::bail!(\"Unsupported .NET SDK version: {major}. SpacetimeDB requires .NET SDK 8.0 or 10.0.\"),\n    }\n}\n\n#[derive(Debug)]\nstruct CsprojTargetFrameworks {\n    path: PathBuf,\n    majors: Vec<u8>,\n}\n\nimpl CsprojTargetFrameworks {\n    fn single_major(&self) -> Option<u8> {\n        (self.majors.len() == 1).then_some(self.majors[0])\n    }\n}\n\n/// Read the target framework major versions directly from the project's `.csproj` file.\n/// Returns `net8.0`, `net10.0`, etc. from both `<TargetFramework>` and `<TargetFrameworks>`.\n/// Multi-target projects do not imply a single selected SDK version; callers should use a","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/9e0d92412ff2248f401a8ad12d535f2b5ac30912/crates/cli/src/tasks/csharp.rs#L1-L36","documentation":"Internal helper dotnet_global_json(major) renders the global.json SDK-pinning template used in error messages and project setup; only .NET SDK majors 8 and 10 have templates, anything else bails here. In the current code it is only called with the build path's resolved SDK (always 8 or 10), so reaching this error means an internal invariant broke or a new call site passed an unvalidated major.","triggerScenarios":"A code path passing an SDK major other than 8/10 into dotnet_global_json -- e.g. a future `spacetime init --dotnet-version 9` flowing through unchecked, or a new CsharpBuildPath variant added without a template. Not reachable through normal CLI usage today.","commonSituations":"CLI development after adding a build path or version flag; --dotnet-version values not validated at the arg-parsing boundary before reaching the build tasks.","solutions":["As a user: use .NET SDK 8 or 10, the only supported majors; re-run with --dotnet-version 8 or --dotnet-version 10 if you passed a version.","As a CLI developer: validate the major at the clap/arg-parsing boundary (accept only 8 or 10) so this remains an unreachable invariant.","If hit unexpectedly, report it as a CLI bug with the exact command line."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Accept only supported majors before invoking the toolchain\ncase \"$DOTNET_VERSION\" in 8|10) ;; *) echo \"unsupported --dotnet-version (use 8 or 10)\" >&2; exit 2 ;; esac\nspacetime build --dotnet-version \"$DOTNET_VERSION\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict --dotnet-version inputs to the set {8, 10} at your own boundaries.","If you hit this via normal CLI usage, file a bug -- it indicates an unvalidated internal path."],"tags":["csharp","dotnet","sdk-version","internal-invariant"],"backgroundTag":"unsupported-sdk-version","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"}