dotnet/runtime · error · RuntimeError

Unknown OS.

Error message

Unknown OS.

What it means

Raised by determine_native_name() in superpmi_aspnet.py when target_os is not one of 'osx', 'linux', or 'windows'. The function maps the OS to the native library suffix (.dylib/.so/.dll) at src/coreclr/scripts/superpmi_aspnet.py:84 and has no mapping for any other value.

Solutions

  1. Pass target_os as exactly 'osx', 'linux', or 'windows'.
  2. Normalize platform.system() output before calling (map 'Darwin' -> 'osx', 'Windows' -> 'windows', 'Linux' -> 'linux').
  3. Run the script on a supported OS.

Example fix

// before
determine_native_name(coreclr_args, "coreclr", "Darwin")
// after
determine_native_name(coreclr_args, "coreclr", "osx")
Defensive patterns

Strategy: validation

Validate before calling

supported = {'osx', 'linux', 'windows'}
if target_os not in supported:
    raise ValueError(f"target_os must be one of {sorted(supported)}, got {target_os!r}")

Type guard

def is_supported_os(target_os: str) -> bool:
    return target_os in ('osx', 'linux', 'windows')

Prevention

When it happens

Trigger: Calling determine_native_name() with a target_os other than osx/linux/windows (e.g. 'freebsd', 'browser', or an empty/unnormalized string).

Common situations: Running the aspnet SuperPMI collection on an unsupported host OS, or passing a target_os derived from platform.system() (e.g. 'Darwin', 'Windows') that was not normalized to the expected lowercase token.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/5ab356f79514e121. Report an issue: GitHub.

Appendix: source

Thrown at src/coreclr/scripts/superpmi_aspnet.py:84

def determine_native_name(coreclr_args, base_lib_name, target_os):
    """ Determine the name of the native lib based on the OS.

    Args:
        coreclr_args (CoreclrArguments): parsed args
        base_lib_name (str) : root name of the lib
        target_os (str) : os to run tests on
    Return:
        (str) : name of the native lib for this OS
    """

    if target_os == "osx":
        return "lib" + base_lib_name + ".dylib"
    elif target_os == "linux":
        return "lib" + base_lib_name + ".so"
    elif target_os == "windows":
        return base_lib_name + ".dll"
    else:
        raise RuntimeError("Unknown OS.")

# Where there is an option, we generally target the less performant machines
# See https://github.com/aspnet/Benchmarks/tree/master/scenarios
#
def determine_benchmark_machine(coreclr_args):
    """ Determine the name of the benchmark machine to use

    Args:
        coreclr_args (CoreclrArguments): parsed args

    Return:
        (str) : name of the benchmnark machine
    """

    if coreclr_args.arch == "x64":
        if coreclr_args.host_os == "windows":
            return "aspnet-perf-win"
#            return "aspnet-citrine-win"

View on GitHub (pinned to 60108ba66e)