abpframework/abp · critical · Exception
Cannot determine operating system!
Error message
Cannot determine operating system!
What it means
Thrown by PlatformHelper.GetOperatingSystem() when RuntimeInformation.IsOSPlatform returns false for OSX, Linux, and Windows. It returns the concrete OSPlatform but cannot classify the host. This is a generic System.Exception because the supported-OS list is exhaustive for ABP's CLI purposes.
Source
Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/PlatformHelper.cs:26
public static OSPlatform GetOperatingSystem()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
//MAC
return OSPlatform.OSX;
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return OSPlatform.Linux;
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return OSPlatform.Windows;
}
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!");
}
}View on GitHub (pinned to 7ed43b1931)
Solutions
- Run the CLI on a supported OS (Windows, Linux, or macOS).
- Upgrade the .NET runtime so RuntimeInformation correctly reports the platform.
- If you must support another Unix, ensure .NET identifies it as Linux (some BSD setups can be coerced via runtime config).
Defensive patterns
Strategy: validation
Validate before calling
static bool IsSupportedOs() =>
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ||
RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
if (!IsSupportedOs()) throw new PlatformNotSupportedException(RuntimeInformation.OSDescription); Prevention
- Run the ABP CLI on Windows, Linux, or macOS only.
- Use a current .NET runtime so OS detection is accurate.
- Document supported OSes for any tooling built on the CLI.
When it happens
Trigger: Running the CLI on an OS that .NET reports as none of OSX/Linux/Windows — e.g. FreeBSD, Solaris, or a platform where the runtime's OS detection is unavailable or returns a custom value.
Common situations: Exotic Unix variants not recognized by .NET's OSPlatform; very old or preview .NET runtimes with incomplete platform detection; running under a runtime shim that masks the real OS.
Related errors
- Cannot determine runtime platform!
- 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/79cf096d35a8cec7.
Report an issue: GitHub.