{"record":{"id":"5ab356f79514e121","repo":"dotnet/runtime","slug":"unknown-os-5ab356","errorCode":null,"errorMessage":"Unknown OS.","messagePattern":"Unknown OS\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/superpmi_aspnet.py","lineNumber":84,"sourceCode":"def determine_native_name(coreclr_args, base_lib_name, target_os):\n    \"\"\" Determine the name of the native lib based on the OS.\n\n    Args:\n        coreclr_args (CoreclrArguments): parsed args\n        base_lib_name (str) : root name of the lib\n        target_os (str) : os to run tests on\n    Return:\n        (str) : name of the native lib for this OS\n    \"\"\"\n\n    if target_os == \"osx\":\n        return \"lib\" + base_lib_name + \".dylib\"\n    elif target_os == \"linux\":\n        return \"lib\" + base_lib_name + \".so\"\n    elif target_os == \"windows\":\n        return base_lib_name + \".dll\"\n    else:\n        raise RuntimeError(\"Unknown OS.\")\n\n# Where there is an option, we generally target the less performant machines\n# See https://github.com/aspnet/Benchmarks/tree/master/scenarios\n#\ndef determine_benchmark_machine(coreclr_args):\n    \"\"\" Determine the name of the benchmark machine to use\n\n    Args:\n        coreclr_args (CoreclrArguments): parsed args\n\n    Return:\n        (str) : name of the benchmnark machine\n    \"\"\"\n\n    if coreclr_args.arch == \"x64\":\n        if coreclr_args.host_os == \"windows\":\n            return \"aspnet-perf-win\"\n#            return \"aspnet-citrine-win\"","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/dotnet/runtime/blob/b7130aa5e416e88ac48fafe92bf56a9d64e13c97/src/coreclr/scripts/superpmi_aspnet.py#L66-L102","documentation":"Raised by the native-lib-name helper in superpmi_aspnet.py when target_os is not one of osx/linux/windows. The helper maps an OS to its native extension (.dylib/.so/.dll) to locate the ASP.NET benchmark native library; an unrecognized OS means the library name cannot be formed.","triggerScenarios":"Calling build_and_run with coreclr_args.host_os set to something like 'freebsd', 'osx.10.14', or a typo, then routing through the lib-name lookup.","commonSituations":"Passing a platform string from an upstream source that includes a version suffix; typos in CLI args; new/unsupported OS added to the matrix before this helper is updated.","solutions":["Set coreclr_args.host_os to exactly 'windows', 'linux', or 'osx'.","Strip version/qualifier suffixes from the OS string before calling the helper.","If you genuinely need a new OS, extend the if/elif chain with its native extension."],"exampleFix":"# before\ntarget_os = coreclr_args.host_os  # 'osx.14'\n# after\ntarget_os = coreclr_args.host_os.split('.')[0]  # 'osx'","handlingStrategy":"validation","validationCode":"SUPPORTED_OS = {'osx', 'linux', 'windows'}\nos_norm = coreclr_args.host_os.split('.')[0].lower()\nassert os_norm in SUPPORTED_OS, f\"Unknown OS {coreclr_args.host_os!r}; expected one of {SUPPORTED_OS}\"","typeGuard":"def is_supported_os(os_str: str) -> bool:\n    return os_str.split('.')[0].lower() in {'osx', 'linux', 'windows'}","tryCatchPattern":null,"preventionTips":["Normalize host_os by stripping version suffixes before calling helpers","Validate the OS against a known set at arg-parse time"],"tags":["superpmi","aspnet","os","native-library"],"analyzedSha":"b7130aa5e416e88ac48fafe92bf56a9d64e13c97","analyzedAt":"2026-08-07T06:17:13.108Z","schemaVersion":2},"datasetVersion":"2026-08-07T15:17:06.553Z"}