{"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/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/scripts/superpmi_collect_setup.py#L650-L686","documentation":"Raised in superpmi_collect_setup.py for the 'corelib' collection when input_directory does not contain System.Private.CoreLib.dll. This collection is a single-assembly crossgen2 run over that exact DLL.","triggerScenarios":"collection_name=='corelib' and os.path.isfile(os.path.join(input_directory,'System.Private.CoreLib.dll')) is false.","commonSituations":"input_directory points at the wrong bin folder (e.g., IL subfolder mismatch between wasm and host layouts); the Core_Root was not built/copied; YAML InputDirectory template produced the wrong path.","solutions":["Verify the expected path exists: `ls <input_directory>/System.Private.CoreLib.dll`.","Point --input_directory at the Core_Root (or the wasm IL dir) that actually contains the DLL.","Ensure the build that produces System.Private.CoreLib.dll completed before this step.","Check the YAML routing logic in the comments above the check for the correct dir per wasm/host."],"exampleFix":"// before\n# --input_directory /wrong/path -> raises [194]\n// after\n--input_directory <core_root_or_wasm_il_dir_containing_System.Private.CoreLib.dll>","handlingStrategy":"validation","validationCode":"import os\ncorelib = os.path.join(input_directory, 'System.Private.CoreLib.dll')\nif collection_name == 'corelib' and not os.path.isfile(corelib):\n    raise SystemExit(f'missing {corelib}; point --input_directory at the Core_Root / wasm IL dir')","typeGuard":"def corelib_present(input_directory: str) -> bool:\n    import os\n    return os.path.isfile(os.path.join(input_directory, 'System.Private.CoreLib.dll'))","tryCatchPattern":"try:\n    main(args)\nexcept RuntimeError as e:\n    if 'System.Private.CoreLib.dll' in str(e):\n        args.input_directory = locate_core_root(); main(args)","preventionTips":["Validate input_directory contents before collection","Ensure the producing build finished first","Log the resolved input_directory for debugging"],"tags":["configuration","nativeaot","superpmi","paths"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}