{"record":{"id":"1395db74859ebc9c","repo":"abpframework/abp","slug":"cannot-determine-runtime-platform","errorCode":null,"errorMessage":"Cannot determine runtime platform!","messagePattern":"Cannot determine runtime platform!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/PlatformHelper.cs","lineNumber":42,"sourceCode":"        }\n\n        throw new Exception(\"Cannot determine operating system!\");\n    }\n\n    public static RuntimePlatform GetPlatform()\n    {\n        if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ||\n            RuntimeInformation.IsOSPlatform(OSPlatform.Linux))\n        {\n            return RuntimePlatform.LinuxOrMacOs;\n        }\n\n        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))\n        {\n            return RuntimePlatform.Windows;\n        }\n\n        throw new Exception(\"Cannot determine runtime platform!\");\n    }\n}\n\npublic enum RuntimePlatform\n{\n    Windows = 1,\n    LinuxOrMacOs = 2\n}\n","sourceCodeStart":24,"sourceCodeEnd":51,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/PlatformHelper.cs#L24-L51","documentation":"Thrown by PlatformHelper.GetPlatform() — the companion to GetOperatingSystem that collapses the host into the RuntimePlatform enum (Windows vs LinuxOrMacOs). If the OS is not OSX, Linux, or Windows, no enum value applies and a generic Exception is raised.","triggerScenarios":"Calling GetPlatform() on a host .NET does not classify as OSX/Linux/Windows. Same root cause as GetOperatingSystem; this method just returns the coarser enum.","commonSituations":"Same as 224: FreeBSD/Solaris/custom Unix or a misconfigured runtime. This path is hit by code that only needs the binary Windows-vs-Unix distinction (e.g. shell selection).","solutions":["Run on a supported OS (Windows, Linux, macOS).","Update the .NET runtime so platform detection works.","For other Unix, configure the runtime to report as Linux."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"static RuntimePlatform? SafePlatform() =>\n    (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) ? RuntimePlatform.LinuxOrMacOs\n    : RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? RuntimePlatform.Windows\n    : null;\nvar p = SafePlatform() ?? throw new PlatformNotSupportedException(\"Unsupported OS\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate platform-dependent code behind an explicit OS check that returns null on unknown.","Test CLI flows on each supported OS in CI.","Keep a current .NET runtime so detection works."],"tags":["abp-cli","platform","environment","unsupported-os"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}