abpframework/abp · critical · Exception
Cannot determine runtime platform!
Error message
Cannot determine runtime platform!
What it means
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.
Source
Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/PlatformHelper.cs:42
}
throw new Exception("Cannot determine operating system!");
}
public static RuntimePlatform GetPlatform()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ||
RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return RuntimePlatform.LinuxOrMacOs;
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return RuntimePlatform.Windows;
}
throw new Exception("Cannot determine runtime platform!");
}
}
public enum RuntimePlatform
{
Windows = 1,
LinuxOrMacOs = 2
}
View on GitHub (pinned to 7ed43b1931)
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.
Defensive patterns
Strategy: validation
Validate before calling
static RuntimePlatform? SafePlatform() =>
(RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) ? RuntimePlatform.LinuxOrMacOs
: RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? RuntimePlatform.Windows
: null;
var p = SafePlatform() ?? throw new PlatformNotSupportedException("Unsupported OS"); Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- Cannot determine operating system!
- Cannot determine shell command for this OS! Running on OS: {
- AES-GCM is not available on .NET Standard 2.0!
- DbMigrations folder path is missing!
- DbMigrator is not found!
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/1395db74859ebc9c.
Report an issue: GitHub.