{"record":{"id":"0cf4627a86cb8e96","repo":"dotnet/BenchmarkDotNet","slug":"system-runtime-interopservices-runtimeinformation","errorCode":null,"errorMessage":"{System.Runtime.InteropServices.RuntimeInformation.OSDescription} is not supported","messagePattern":"(.+?) is not supported","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/BenchmarkDotNet/Disassemblers/ClrMdDisassembler.cs","lineNumber":30,"sourceCode":"\n    {\n        private static readonly ulong MinValidAddress = GetMinValidAddress();\n\n        private static ulong GetMinValidAddress()\n        {\n            // https://github.com/dotnet/BenchmarkDotNet/pull/2413#issuecomment-1688100117\n            if (OsDetector.IsWindows())\n                return ushort.MaxValue + 1;\n            if (OsDetector.IsLinux())\n                return (ulong)Environment.SystemPageSize;\n            if (OsDetector.IsMacOS())\n                return RuntimeInformation.GetCurrentPlatform() switch\n                {\n                    Environments.Platform.X86 or Environments.Platform.X64 => 4096,\n                    Environments.Platform.Arm64 => 0x100000000,\n                    var platform => throw new NotSupportedException($\"{platform} is not supported\")\n                };\n            throw new NotSupportedException($\"{System.Runtime.InteropServices.RuntimeInformation.OSDescription} is not supported\");\n        }\n\n        protected static bool IsValidAddress(ulong address)\n            // -1 (ulong.MaxValue) address is invalid, and will crash the runtime in older runtimes. https://github.com/dotnet/runtime/pull/90794\n            // 0 is NULL and therefore never valid.\n            // Addresses less than the minimum virtual address are also invalid.\n            => address != ulong.MaxValue\n                && address != 0\n                && address >= MinValidAddress;\n\n        // When ClrMD's GetMethodByInstructionPointer fails on a call target, the bytes at that\n        // address may be (a) a small JMP/B thunk the JIT inserted because the real callee was too\n        // far for a direct relative branch, or (b) a CoreCLR precode/stub (call-counting stub,\n        // stub precode, fixup precode) — the stable entry point for a tiered method. Architecture\n        // -specific subclasses decode their respective shapes and return the resolved target\n        // (the Target slot for precodes) so TryTranslateAddressToName can retry the lookup.\n        // Best-effort: return false for anything we don't recognise (matches prior behaviour).\n        protected abstract bool TryFollowJumpTrampoline(State state, ulong address, out ulong target);","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet/Disassemblers/ClrMdDisassembler.cs#L12-L48","documentation":"GetMinValidAddress first checks OsDetector for Windows, Linux, then macOS; if none match it throws NotSupportedException including RuntimeInformation.OSDescription. So this is the operating-system guard for the ClrMD disassembler's minimum-address logic: any OS outside Windows/Linux/macOS is unsupported.","triggerScenarios":"Running the disassembler on an OS that OsDetector does not classify as Windows, Linux, or macOS (e.g. FreeBSD, illumos, or a platform where OsDetector detection fails).","commonSituations":"CI on niche Unix variants, containers with an unusual OSDescription string that defeats OsDetector, or a BSD-derived system.","solutions":["Run disassembly on a supported OS (Windows, Linux, or macOS).","Disable the DisassemblyDiagnoser on unsupported operating systems before running.","If your OS is genuinely Linux-like but OsDetector misclassifies it, verify OsDetector.IsLinux() and report the detection bug.","Use a different diagnoser that does not require ClrMD attachment on unsupported OSes."],"exampleFix":"// before - disassembler always on\nconfig.AddDiagnoser(new DisassemblyDiagnoser(...));\n\n// after - gate disassembler on a supported OS\nif (OsDetector.IsWindows() || OsDetector.IsLinux() || OsDetector.IsMacOS())\n    config.AddDiagnoser(new DisassemblyDiagnoser(...));","handlingStrategy":"fallback","validationCode":"if (!(OsDetector.IsWindows() || OsDetector.IsLinux() || OsDetector.IsMacOS()))\n    config = config.WithoutDisassembler(); // unsupported OS for min-address logic","typeGuard":"static bool DisassemblerOsSupported()\n    => OsDetector.IsWindows() || OsDetector.IsLinux() || OsDetector.IsMacOS();","tryCatchPattern":"try { disassembler.AttachAndDisassemble(args); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"is not supported\"))\n{\n    // disable disassembly for this run and continue without it\n}","preventionTips":["Run the disassembler only on Windows, Linux, or macOS.","Disable the DisassemblyDiagnoser on niche Unix/BSD OSes.","Verify OsDetector classification in CI before enabling disassembly."],"tags":["disassembler","operating-system","platform","notsupported"],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}