{"record":{"id":"fbaa9af93f59ec48","repo":"dotnet/runtime","slug":"cannot-find-system-private-corelib-dll-at-corelib","errorCode":null,"errorMessage":"Cannot find System.Private.CoreLib.dll at {corelib_src}","messagePattern":"Cannot find System\\.Private\\.CoreLib\\.dll at (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/superpmi_collect_setup.py","lineNumber":668,"sourceCode":"                              if os.path.isfile(os.path.join(core_root_dir, item)) and (item.endswith(\".dll\") or item.endswith(\".exe\"))]\n\n        if coreclr_args.collection_name == \"smoke_tests\":\n            if coreclr_args.collection_type != \"nativeaot\":\n                raise RuntimeError(\"Collection 'smoke_tests' is only available for 'nativeaot' collections.\")\n\n        if coreclr_args.collection_name == \"corelib\":\n            # corelib is a single-assembly crossgen2 collection over a pre-built\n            # System.Private.CoreLib.dll. The YAML routes InputDirectory to:\n            #   - the wasm-built corelib bin dir (artifacts/bin/coreclr/browser.wasm.Release/IL)\n            #     for wasm cross-target collections, or\n            #   - the host release Core_Root for non-cross-target collections.\n            # Build a custom one-file input directory so the partitioning logic produces\n            # exactly one helix partition. The references crossgen2 needs are resolved\n            # out of the release Core_Root that's part of the correlation payload (see\n            # run_crossgen2 in superpmi.py, which passes -r:<core_root>\\System.*.dll etc.).\n            corelib_src = os.path.join(coreclr_args.input_directory, \"System.Private.CoreLib.dll\")\n            if not os.path.isfile(corelib_src):\n                raise RuntimeError(\"Cannot find System.Private.CoreLib.dll at \" + corelib_src)\n            corelib_input_dir = os.path.join(workitem_payload_directory, \"corelib_input\")\n            os.makedirs(corelib_input_dir, exist_ok=True)\n            copy_files(coreclr_args.input_directory, corelib_input_dir, [corelib_src])\n            coreclr_args.input_directory = corelib_input_dir\n\n        partition_files(coreclr_args.input_directory, input_artifacts, coreclr_args.max_size, exclude_directories,\n                        exclude_files)\n\n    # Set variables\n    print('Setting pipeline variables:')\n    set_pipeline_variable(\"CorrelationPayloadDirectory\", correlation_payload_directory)\n    set_pipeline_variable(\"WorkItemDirectory\", workitem_payload_directory)\n    set_pipeline_variable(\"InputArtifacts\", input_artifacts)\n    set_pipeline_variable(\"Python\", ' '.join(get_python_name()))\n    set_pipeline_variable(\"Architecture\", arch)\n    set_pipeline_variable(\"Queue\", helix_queue)\n    set_pipeline_variable(\"HelixSourcePrefix\", helix_source_prefix)\n    set_pipeline_variable(\"MchFileTag\", coreclr_args.mch_file_tag)","sourceCodeStart":650,"sourceCodeEnd":686,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/scripts/superpmi_collect_setup.py#L650-L686","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify input_directory contains System.Private.CoreLib.dll (list it before running).","Build coreclr for the target so System.Private.CoreLib.dll is produced.","For wasm cross-target collections, point InputDirectory at artifacts/bin/coreclr/browser.wasm.Release/IL; otherwise at the host release Core_Root."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import os\ncorelib_src = os.path.join(coreclr_args.input_directory, 'System.Private.CoreLib.dll')\nif coreclr_args.collection_name == 'corelib' and not os.path.isfile(corelib_src):\n    raise SystemExit(f'Missing {corelib_src} — build coreclr first or fix InputDirectory')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate that input_directory contains System.Private.CoreLib.dll before submitting the Helix job."],"tags":["dotnet","coreclr","superpmi","build","configuration","pipeline"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}