dotnet / dotnet/runtime

[NativeAOT] IlcCompileInput ignores ILLink output when RunILLink=true

Open
#127,577 1 comment 1 reaction 2 assignees Claimed by @sbomer View on GitHub
area-NativeAOT-coreclr
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

`ComputeIlcCompileInputs` in `Microsoft.NETCore.Native.targets` sets `IlcCompileInput` from `@(IntermediateAssembly)`. When `RunILLink=true` and ILLink runs before ILC, the main assembly in `$(IntermediateLinkDir)` may differ from `IntermediateAssembly` (e.g. due to pre-trimming assembly rewrites). ILC compiles the wrong assembly, causing runtime failures.

The default NativeAOT flow has `RunILLink=false` so this does not arise. Android sets `RunILLink=true` to run custom ILLink steps before ILC.

**Workaround:**

Override `IlcCompileInput` after `ComputeIlcCompileInputs`:
```xml

```

Related: dotnet/android#11183

*This content was created with assistance from AI.*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.