dotnet/runtime · error · RuntimeError

Core_Root not set properly

Error message

Core_Root not set properly

What it means

Raised by determine_coredistools when coreclr_args has no 'core_root' attribute or it is None. Core_Root is the directory containing the built .NET runtime binaries (CoreRun, clrjit, etc.) and is the primary location SuperPMI looks for tools and coredistools. Without it, the function cannot locate or place the disassembler native library needed for asm diffs.

Solutions

  1. Build a Core_Root by running the runtime build with the test target (e.g. build.cmd/sh with the coreclr/libraries/tests components) or run 'build -subset coreclr' then create Core_Root via the usual artifacts path.
  2. Pass --core_root <path> explicitly pointing to your built runtime output directory.
  3. Set the CORE_ROOT environment variable if your workflow uses it, or ensure setup_args defaulted it correctly.
  4. Verify the CoreclrArguments.verify('core_root', ...) step in setup_args ran successfully and did not silently leave it None.

Example fix

// before
if not hasattr(coreclr_args, "core_root") or coreclr_args.core_root is None:
    raise RuntimeError("Core_Root not set properly")
// after
if not hasattr(coreclr_args, "core_root") or coreclr_args.core_root is None:
    raise RuntimeError("Core_Root not set; pass --core_root <path> or build the runtime with a Core_Root (e.g. 'build -subset coreclr')")
Defensive patterns

Strategy: validation

Validate before calling

import os
def ensure_core_root(coreclr_args):
    if not hasattr(coreclr_args, 'core_root') or coreclr_args.core_root is None:
        raise RuntimeError('Core_Root is not set. Pass --core_root <path> or build the runtime to create one.')
    if not os.path.isdir(coreclr_args.core_root):
        raise RuntimeError(f"Core_Root path does not exist or is not a directory: {coreclr_args.core_root}")
    return coreclr_args.core_root

Prevention

When it happens

Trigger: Called when the asm-diff/asmdiff workflow needs coredistools: if not hasattr(coreclr_args, 'core_root') or coreclr_args.core_root is None, it raises immediately. This happens when the script is invoked without building a Core_Root (e.g. product-only build) and without passing --core_root, and the CoreclrArguments defaulting did not populate it.

Common situations: Invoking superpmi.py asmdiff on a fresh clone where only 'build' (not 'build_coreclr tests') was run; passing --core_root with an empty value; running in a sub-mode that set require_built_core_root=False and never supplied a path.

Related errors


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

Appendix: source

Thrown at src/coreclr/scripts/superpmi.py:3750

    """ Determine the coredistools location in one of several locations:
        1. First, look in Core_Root. It will be there if the setup-stress-dependencies.cmd/sh
        script has been run, which is typically only if tests have been run.
        2. The build appears to restore it and put it in the R2RDump sub-directory. Look there.
        Copy it to the Core_Root directory if found.
        3. If unable to find coredistools, download it from a cached
        copy in the CLRJIT Azure Storage. (Ideally, we would instead download the NuGet
        package and extract it using the same mechanism as setup-stress-dependencies
        instead of having our own copy in Azure Storage).

    Args:
        coreclr_args (CoreclrArguments) : parsed args

    Returns:
        coredistools_location (str)     : path of [lib]coredistools.dylib|so|dll
    """

    if not hasattr(coreclr_args, "core_root") or coreclr_args.core_root is None:
        raise RuntimeError("Core_Root not set properly")

    coredistools_dll_name = None
    if coreclr_args.host_os.lower() == "osx":
        coredistools_dll_name = "libcoredistools.dylib"
    elif coreclr_args.host_os.lower() == "linux":
        coredistools_dll_name = "libcoredistools.so"
    elif coreclr_args.host_os.lower() == "windows":
        coredistools_dll_name = "coredistools.dll"
    else:
        raise RuntimeError("Unknown host os: {}".format(coreclr_args.host_os))

    coredistools_location = os.path.join(coreclr_args.core_root, coredistools_dll_name)
    if os.path.isfile(coredistools_location):
        logging.info("Using coredistools found at %s", coredistools_location)
    else:
        coredistools_r2rdump_location = os.path.join(coreclr_args.core_root, "R2RDump", coredistools_dll_name)
        if os.path.isfile(coredistools_r2rdump_location):
            logging.info("Using coredistools found at %s (copying to %s)", coredistools_r2rdump_location, coredistools_location)

View on GitHub (pinned to 60108ba66e)