dotnet/runtime · error · RuntimeError
No .mc files generated.
Error message
No .mc files generated.
What it means
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.
Source
Thrown at src/coreclr/scripts/superpmi.py:1350
# Set environment variables.
nativeaot_command_env = env_copy.copy()
set_and_report_env(nativeaot_command_env, root_env)
old_env = os.environ.copy()
os.environ.update(nativeaot_command_env)
ilc_rsps = list(filter(lambda ilc_rsp: ilc_rsp.endswith(".ilc.rsp"), ilc_rsps))
helper = AsyncSubprocessHelper(ilc_rsps, verbose=True)
helper.run_to_completion(run_nativeaot, self)
os.environ.clear()
os.environ.update(old_env)
################################################################################################ end of "self.coreclr_args.nativeaot is True"
mc_files = [os.path.join(self.temp_location, item) for item in os.listdir(self.temp_location) if item.endswith(".mc")]
if len(mc_files) == 0:
raise RuntimeError("No .mc files generated.")
def __merge_mc_files__(self):
""" Merge the mc files that were generated
Notes:
mcs -merge <s_baseMchFile> <s_tempDir>\\*.mc -recursive -dedup -thin
"""
logging.info("Merging MC files")
pattern = os.path.join(self.temp_location, "*.mc")
command = [self.mcs_path, "-merge", self.base_mch_file, pattern, "-recursive", "-dedup", "-thin"]
run_and_log(command)
if not os.path.isfile(self.base_mch_file):
raise RuntimeError("MCH file failed to be generated at: %s" % self.base_mch_file)View on GitHub (pinned to 290d5ab72c)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
# After the collection driver runs, verify .mc output exists before merging
import glob
mc_files = glob.glob(os.path.join(temp_location, '*.mc'))
if not mc_files:
raise SystemExit('No .mc files produced; inspect the pmi/crossgen2/ilc stderr above.') Try / catch
try:
collection.__collect_mc_files__()
except RuntimeError as e:
if 'No .mc files' in str(e):
logging.error('Collection produced no MC files; re-run verbose and check the JIT/Core_Root.')
raise
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Expected a '.ilc.rsp' file for nativeaot, but got {original_
- Unable to find input file in {original_rsp_filepath}
- MCH file failed to be generated at: %s
- Final mch file failed to be generated.
- Error, toc file not created correctly at: %s
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/0c880c2771598baf.
Report an issue: GitHub.