Skip to content

[NativeAOT] IlcCompileInput ignores ILLink output when RunILLink=true #127577

Description

@sbomer

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:

<IlcCompileInput Remove="@(IlcCompileInput)" />
<IlcCompileInput Include="$(IntermediateLinkDir)$(TargetName)$(TargetExt)" />

Related: dotnet/android#11183

This content was created with assistance from AI.

Metadata

Metadata

Assignees

Type

No type

Projects

Status
No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions