Unity-Technologies/UnityCsReference · critical · NotSupportedException

Unsupported OS platform {RuntimeInformation.OSDescription}

Error message

Unsupported OS platform {RuntimeInformation.OSDescription}

What it means

Thrown by GetCurrentDotNETRuntimeId (UnityEditorMSBuildPropsTargetsGeneration.cs:220, NotSupportedException) when the host OS is reported as neither Windows, Linux, nor macOS (RuntimeInformation.IsOSPlatform returns false for all three). This is the fallthrough after the Windows/macOS branches and indicates an entirely unsupported operating system for Unity's bundled .NET toolchain.

Source

Thrown at Editor/Mono/Scripting/ScriptCompilation/MsBuild/UnityEditorMSBuildPropsTargetsGeneration.cs:220

        }
        else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
        {
            return "linux-x64";
        }
        else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
        {
            switch (RuntimeInformation.ProcessArchitecture)
            {
                case Architecture.Arm64:
                    return "osx-arm64";
                case Architecture.X64:
                    return "osx-x64";
                default:
                    throw new NotSupportedException($"Unsupported architecture {RuntimeInformation.ProcessArchitecture} on macOS");
            }
        }

        throw new NotSupportedException($"Unsupported OS platform {RuntimeInformation.OSDescription}");
    }

    private static string s_cachedUnitySdkVersion;

    // Reads the version from Unity.Sdk.<version>.nupkg so global.json tracks CI's bumped value
    // (in sdk/UnitySdksCommon.props) instead of a hardcoded literal.
    private static string GetUnitySdkVersion(string sdkNugetsPath)
    {
        if (s_cachedUnitySdkVersion != null)
            return s_cachedUnitySdkVersion;

        const string prefix = "Unity.Sdk.";
        const string suffix = ".nupkg";

        if (!Directory.Exists(sdkNugetsPath))
            throw new DirectoryNotFoundException($"Unity SDK nuget feed not found at {sdkNugetsPath}");

        foreach (var file in Directory.EnumerateFiles(sdkNugetsPath, $"{prefix}*{suffix}"))

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Run Unity Editor on a supported operating system (Windows, macOS, or a supported Linux distribution).
  2. If the OS is actually supported but misreported, ensure the .NET runtime is the one Unity ships rather than a system runtime that mis-detects the platform.
Defensive patterns

Strategy: validation

Validate before calling

bool supported = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
               || RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
               || RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
if (!supported)
    throw new PlatformNotSupportedException(
        $"Unity Editor requires Windows, macOS, or Linux (got {RuntimeInformation.OSDescription}).");

Prevention

When it happens

Trigger: Running the editor on an OS such as FreeBSD, a non-standard Linux distribution misreported by the runtime, or an unsupported Unix.

Common situations: Unsupported OS, broken OS detection, or an exotic container/VM where RuntimeInformation.OSDescription does not match a supported platform.

Related errors


AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13). Data as JSON: /api/errors/a6b45f57360b19bc. Report an issue: GitHub.