dotnet/BenchmarkDotNet · error · NotSupportedException

{platform} is not supported

Error message

{platform} is not supported

What it means

GetMinValidAddress computes the lowest plausible virtual address the disassembler should consider. On macOS it branches on the current architecture: X86/X64 return 4096, Arm64 returns 0x100000000, and any other architecture (the switch's `var platform` discard) throws NotSupportedException. This is an architecture guard specific to macOS disassembly.

Source

Thrown at src/BenchmarkDotNet/Disassemblers/ClrMdDisassembler.cs:28

{
    internal abstract class ClrMdDisassembler

    {
        private static readonly ulong MinValidAddress = GetMinValidAddress();

        private static ulong GetMinValidAddress()
        {
            // https://github.com/dotnet/BenchmarkDotNet/pull/2413#issuecomment-1688100117
            if (OsDetector.IsWindows())
                return ushort.MaxValue + 1;
            if (OsDetector.IsLinux())
                return (ulong)Environment.SystemPageSize;
            if (OsDetector.IsMacOS())
                return RuntimeInformation.GetCurrentPlatform() switch
                {
                    Environments.Platform.X86 or Environments.Platform.X64 => 4096,
                    Environments.Platform.Arm64 => 0x100000000,
                    var platform => throw new NotSupportedException($"{platform} is not supported")
                };
            throw new NotSupportedException($"{System.Runtime.InteropServices.RuntimeInformation.OSDescription} is not supported");
        }

        protected static bool IsValidAddress(ulong address)
            // -1 (ulong.MaxValue) address is invalid, and will crash the runtime in older runtimes. https://github.com/dotnet/runtime/pull/90794
            // 0 is NULL and therefore never valid.
            // Addresses less than the minimum virtual address are also invalid.
            => address != ulong.MaxValue
                && address != 0
                && address >= MinValidAddress;

        // When ClrMD's GetMethodByInstructionPointer fails on a call target, the bytes at that
        // address may be (a) a small JMP/B thunk the JIT inserted because the real callee was too
        // far for a direct relative branch, or (b) a CoreCLR precode/stub (call-counting stub,
        // stub precode, fixup precode) — the stable entry point for a tiered method. Architecture
        // -specific subclasses decode their respective shapes and return the resolved target
        // (the Target slot for precodes) so TryTranslateAddressToName can retry the lookup.

View on GitHub (pinned to b515068b61)

Solutions

  1. Run the disassembler on a supported macOS architecture (x64 or Arm64).
  2. If disassembly is optional, disable the DisassemblyDiagnoser on unsupported architectures via a filter/platform guard.
  3. Report the architecture to the BDN project if it is a legitimate new Apple platform so the switch can be extended.
  4. Avoid forcing DisassemblyDiagnoser.UseBuiltInDisassembler on unverified hardware.

Example fix

// before - diagnoser enabled unconditionally on all platforms
.WithDisassembler(new ClrMdDisassembler(...))

// after - gate on supported arch before enabling disassembly
if (RuntimeInformation.OSArchitecture is Architecture.X64 or Architecture.Arm64)
    config = config.WithDisassembler(new ClrMdDisassembler(...));
Defensive patterns

Strategy: fallback

Validate before calling

if (RuntimeInformation.OSArchitecture is not (Architecture.X64 or Architecture.Arm64))
    config = config.WithoutDisassembler(); // or do not add the DisassemblyDiagnoser

Type guard

static bool IsSupportedMacArch()
    => RuntimeInformation.OSArchitecture is Architecture.X64 or Architecture.Arm64;

Try / catch

try { disassembler.AttachAndDisassemble(args); }
catch (NotSupportedException ex) when (ex.Message.Contains("is not supported") && OsDetector.IsMacOS())
{
    // fall back to running without disassembly on this architecture
}

Prevention

When it happens

Trigger: Running the ClrMD disassembler on macOS on an architecture other than x86, x64, or Arm64 (e.g. a future Apple architecture or a misreported platform).

Common situations: New Apple Silicon variants, a runtime that reports an unexpected OSArchitecture, or running under Rosetta in a way that surfaces a different platform id.

Related errors


AI-assisted analysis of dotnet/BenchmarkDotNet@b515068b61 (2026-08-13). Data as JSON: /api/errors/c7e37f5a3c75d0e6. Report an issue: GitHub.