{"record":{"id":"0c880c2771598baf","repo":"dotnet/runtime","slug":"no-mc-files-generated","errorCode":null,"errorMessage":"No .mc files generated.","messagePattern":"No \\.mc files generated\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/superpmi.py","lineNumber":1350,"sourceCode":"\n                # Set environment variables.\n                nativeaot_command_env = env_copy.copy()\n                set_and_report_env(nativeaot_command_env, root_env)\n\n                old_env = os.environ.copy()\n                os.environ.update(nativeaot_command_env)\n\n                ilc_rsps = list(filter(lambda ilc_rsp: ilc_rsp.endswith(\".ilc.rsp\"), ilc_rsps))\n                helper = AsyncSubprocessHelper(ilc_rsps, verbose=True)\n                helper.run_to_completion(run_nativeaot, self)\n\n                os.environ.clear()\n                os.environ.update(old_env)\n            ################################################################################################ end of \"self.coreclr_args.nativeaot is True\"\n\n        mc_files = [os.path.join(self.temp_location, item) for item in os.listdir(self.temp_location) if item.endswith(\".mc\")]\n        if len(mc_files) == 0:\n            raise RuntimeError(\"No .mc files generated.\")\n\n    def __merge_mc_files__(self):\n        \"\"\" Merge the mc files that were generated\n\n        Notes:\n            mcs -merge <s_baseMchFile> <s_tempDir>\\\\*.mc -recursive -dedup -thin\n\n        \"\"\"\n\n        logging.info(\"Merging MC files\")\n\n        pattern = os.path.join(self.temp_location, \"*.mc\")\n\n        command = [self.mcs_path, \"-merge\", self.base_mch_file, pattern, \"-recursive\", \"-dedup\", \"-thin\"]\n        run_and_log(command)\n\n        if not os.path.isfile(self.base_mch_file):\n            raise RuntimeError(\"MCH file failed to be generated at: %s\" % self.base_mch_file)","sourceCodeStart":1332,"sourceCodeEnd":1368,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/scripts/superpmi.py#L1332-L1368","documentation":"Raised at the end of `__collect_mc_files__` (superpmi.py:1348-1350) when no `*.mc` files were produced in the temp directory after the pmi/crossgen2/nativeaot collection step. The `.mc` files are the per-assembly SuperPMI method-context output that later get merged into an MCH; zero of them means the underlying collection tool produced nothing usable.","triggerScenarios":"The collection driver (pmi.dll, crossgen2, or ilc) ran but wrote no `.mc` files into temp_location. Common causes: the collection tool exited non-zero or crashed, assemblies path was wrong/empty, Core_Root/JIT mismatch, env vars (DOTNET_*) misconfigured, or the exclude list removed everything.","commonSituations":"Pointing `-assemblies` at a path with no managed dlls; using a Core_Root missing clrjit/corerun; an arch/build-type mismatch between the JIT and the runtime; antimalware or permission issues deleting the `.mc` files as they are written.","solutions":["Re-run with verbose logging and inspect the collection tool's stderr/return code (pmi/crossgen2/ilc) for the real failure.","Verify `-assemblies` resolves to real managed dlls and that `-exclude` is not removing all of them.","Confirm Core_Root contains the matching clrjit/corerun for the chosen arch and build type.","Check the temp directory is writable and not being cleaned by AV/CI between writes."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# After the collection driver runs, verify .mc output exists before merging\nimport glob\nmc_files = glob.glob(os.path.join(temp_location, '*.mc'))\nif not mc_files:\n    raise SystemExit('No .mc files produced; inspect the pmi/crossgen2/ilc stderr above.')","typeGuard":null,"tryCatchPattern":"try:\n    collection.__collect_mc_files__()\nexcept RuntimeError as e:\n    if 'No .mc files' in str(e):\n        logging.error('Collection produced no MC files; re-run verbose and check the JIT/Core_Root.')\n        raise\n    raise","preventionTips":["Always inspect the collection driver's return code/stderr before trusting MC output.","Confirm Core_Root and assemblies paths are correct and arch/build-type matched."],"tags":["collection","superpmi","diagnostics","file-io"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}