dotnet/runtime · error · RuntimeError

Cannot find System.Private.CoreLib.dll at

Error message

Cannot find System.Private.CoreLib.dll at {corelib_src}

What it means

Raised by superpmi_collect_setup.py at src/coreclr/scripts/superpmi_collect_setup.py:668 for the 'corelib' collection when System.Private.CoreLib.dll is not present at <input_directory>/System.Private.CoreLib.dll. The corelib collection is a single-assembly crossgen2 run that requires this pre-built assembly.

Solutions

  1. Verify input_directory contains System.Private.CoreLib.dll (list it before running).
  2. Build coreclr for the target so System.Private.CoreLib.dll is produced.
  3. For wasm cross-target collections, point InputDirectory at artifacts/bin/coreclr/browser.wasm.Release/IL; otherwise at the host release Core_Root.
Defensive patterns

Strategy: validation

Validate before calling

import os
corelib_src = os.path.join(coreclr_args.input_directory, 'System.Private.CoreLib.dll')
if coreclr_args.collection_name == 'corelib' and not os.path.isfile(corelib_src):
    raise SystemExit(f'Missing {corelib_src} — build coreclr first or fix InputDirectory')

Prevention

When it happens

Trigger: Selecting collection_name=corelib when the input_directory does not contain a built System.Private.CoreLib.dll (the coreclr build for that target did not run, or output went to a different artifacts folder).

Common situations: InputDirectory YAML field points to the wrong artifacts folder; wasm vs non-wasm build path mismatch; the coreclr build was skipped so the DLL was never produced.

Related errors


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

Appendix: source

Thrown at src/coreclr/scripts/superpmi_collect_setup.py:668

                              if os.path.isfile(os.path.join(core_root_dir, item)) and (item.endswith(".dll") or item.endswith(".exe"))]

        if coreclr_args.collection_name == "smoke_tests":
            if coreclr_args.collection_type != "nativeaot":
                raise RuntimeError("Collection 'smoke_tests' is only available for 'nativeaot' collections.")

        if coreclr_args.collection_name == "corelib":
            # corelib is a single-assembly crossgen2 collection over a pre-built
            # System.Private.CoreLib.dll. The YAML routes InputDirectory to:
            #   - the wasm-built corelib bin dir (artifacts/bin/coreclr/browser.wasm.Release/IL)
            #     for wasm cross-target collections, or
            #   - the host release Core_Root for non-cross-target collections.
            # Build a custom one-file input directory so the partitioning logic produces
            # exactly one helix partition. The references crossgen2 needs are resolved
            # out of the release Core_Root that's part of the correlation payload (see
            # run_crossgen2 in superpmi.py, which passes -r:<core_root>\System.*.dll etc.).
            corelib_src = os.path.join(coreclr_args.input_directory, "System.Private.CoreLib.dll")
            if not os.path.isfile(corelib_src):
                raise RuntimeError("Cannot find System.Private.CoreLib.dll at " + corelib_src)
            corelib_input_dir = os.path.join(workitem_payload_directory, "corelib_input")
            os.makedirs(corelib_input_dir, exist_ok=True)
            copy_files(coreclr_args.input_directory, corelib_input_dir, [corelib_src])
            coreclr_args.input_directory = corelib_input_dir

        partition_files(coreclr_args.input_directory, input_artifacts, coreclr_args.max_size, exclude_directories,
                        exclude_files)

    # Set variables
    print('Setting pipeline variables:')
    set_pipeline_variable("CorrelationPayloadDirectory", correlation_payload_directory)
    set_pipeline_variable("WorkItemDirectory", workitem_payload_directory)
    set_pipeline_variable("InputArtifacts", input_artifacts)
    set_pipeline_variable("Python", ' '.join(get_python_name()))
    set_pipeline_variable("Architecture", arch)
    set_pipeline_variable("Queue", helix_queue)
    set_pipeline_variable("HelixSourcePrefix", helix_source_prefix)
    set_pipeline_variable("MchFileTag", coreclr_args.mch_file_tag)

View on GitHub (pinned to 60108ba66e)