dotnet/runtime · error · RuntimeError
Expected a '.ilc.rsp' file for nativeaot, but got {original_
Error message
Expected a '.ilc.rsp' file for nativeaot, but got {original_rsp_filepath} What it means
Raised inside the async `run_nativeaot` worker (superpmi.py:1187-1189) during a nativeaot collection. Every entry passed via `-ilc_rsps` must be an ILC response file whose name ends in `.ilc.rsp`; anything else is rejected before the rsp is parsed and rewritten. The collection only understands native AOT ilc.rsp inputs, so a different file type cannot be processed.
Source
Thrown at src/coreclr/scripts/superpmi.py:1189
# Note: crossgen2 compiles in parallel by default. However, it seems to lead to sharing violations
# in SuperPMI collection, accessing the MC file. So, disable crossgen2 parallism by using
# the "--parallelism:1" switch, and allowing coarse-grained (per-assembly) parallelism here.
# It turns out this works better anyway, as there is a lot of non-parallel time between
# crossgen2 parallel compilations.
helper = AsyncSubprocessHelper(assemblies, verbose=True)
helper.run_to_completion(run_crossgen2, self)
os.environ.clear()
os.environ.update(old_env)
################################################################################################ end of "self.coreclr_args.crossgen2 is True"
################################################################################################ Do collection using nativeaot
if self.coreclr_args.nativeaot is True:
logging.debug("Starting collection using nativeaot")
async def run_nativeaot(print_prefix, original_rsp_filepath, self):
if not original_rsp_filepath.endswith(".ilc.rsp"):
raise RuntimeError(f"Expected a '.ilc.rsp' file for nativeaot, but got {original_rsp_filepath}")
# The contents of the rsp contain many knobs and arguments that represent customer scenarios.
# Make a copy of the .ilc.rsp file as we are going to modify it. We do not want to modify the original one.
# The modifications include re-writing paths for references, input assembly and the output.
# We do this because the current paths in the rsp *may* not exist by the time we want to run ilc.
rsp_filepath = os.path.join(self.temp_location, make_safe_filename("nativeaot_" + original_rsp_filepath) + ".rsp")
shutil.copyfile(original_rsp_filepath, rsp_filepath)
rsp_file = open(rsp_filepath, "r")
rsp_contents = rsp_file.readlines()
rsp_file.close()
original_input_filepath = ""
for line in rsp_contents:
if not line.startswith("-"):
original_input_filepath = line
View on GitHub (pinned to 290d5ab72c)
Solutions
- Ensure every path in `-ilc_rsps` is an actual `*.ilc.rsp` file produced by the native AOT build.
- If you passed a directory, enumerate its `.ilc.rsp` files and pass those explicit paths.
- Filter the list with a shell glob like `-ilc_rsps path/**/*.ilc.rsp` to exclude unrelated files.
Example fix
// before superpmi.py collect --nativeaot -ilc_rsps tests/ComWrappers/native/ComWrappers.csproj // after superpmi.py collect --nativeaot -ilc_rsps tests/ComWrappers/native/ComWrappers.ilc.rsp
Defensive patterns
Strategy: validation
Validate before calling
# Validate ilc_rsp inputs before launching the nativeaot collection
ilc_rsps = [p for p in args.ilc_rsps]
bad = [p for p in ilc_rsps if not p.endswith('.ilc.rsp')]
if bad:
raise SystemExit('All -ilc_rsps entries must end in .ilc.rsp; offending: ' + ', '.join(bad)) Prevention
- Glob with **/*.ilc.rsp instead of passing directories.
- Reject non-.ilc.rsp paths in the wrapper before invoking superpmi.
When it happens
Trigger: Invoking `superpmi.py collect --nativeaot -ilc_rsps <path>` where one of the supplied paths does not end with `.ilc.rsp` (e.g. a directory, a `.dll`, a `.csproj`, or a generic `.rsp`). The AsyncSubprocessHelper dispatches each path to run_nativeaot, which fails on the first non-matching path.
Common situations: Passing a parent directory or a glob expansion that includes non-rsp files to `-ilc_rsps`; pointing at a plain crossgen2/csc response file instead of the ILC-generated `.ilc.rsp`; typo in the filename extension.
Related errors
- Unable to find input file in {original_rsp_filepath}
- Tiering options have no effect for nativeaot collections.
- Pass only one tiering option.
- No .mc files generated.
- PMI not found at {}
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/c2eb3651a63aa3bb.
Report an issue: GitHub.