Undo the ILLink/ILC enum-field substitution workaround from #26371 once dotnet/runtime#131601 is fixed
- Dominant language
- C#
- Stars
- 2.9k
- Forks
- 576
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 108
Description
### Background
PR #26371 works around an incompatibility between ILLink and ILC (NativeAOT) in how they parse the substitution value for an **enum-typed field** in `ILLink.Substitutions.xml`:
| Tool | Accepted value |
|--------|----------------------------|
| ILLink | the enum member's **name** (e.g. `DEVICE` / `SIMULATOR`) |
| ILC | the **numeric** value (e.g. `0` / `1`) |
There is no single value that works for both, and each reports `IL2015` for the other's format. This surfaced on .NET 11 with NativeAOT, where ILLink is skipped entirely and ILC parses our substitution XML itself for the first time.
This is tracked upstream as https://github.com/dotnet/runtime/issues/131601.
### The workaround to undo
In PR #26371 we specified **both** variants of the `ObjCRuntime.Runtime.Arch` field substitution, in two separate `` blocks selected by a new `ObjCRuntime.IsILCompiler` feature switch, and pass `--feature:ObjCRuntime.IsILCompiler=true` only to ILC.
Once dotnet/runtime#131601 is fixed (i.e. ILLink and ILC agree on the accepted substitution value format), we should undo the workaround:
- Remove the duplicated `` blocks in `src/ILLink.Substitutions.iOS.xml` and `src/ILLink.Substitutions.tvOS.xml` (and any others that gained them), keeping a single `Arch` field substitution with whichever value both tools accept.
- Remove the `--feature:ObjCRuntime.IsILCompiler=true` `IlcArg` from `_XamarinComputeIlcCompileInputs` in `dotnet/targets/Xamarin.Shared.Sdk.targets`, along with the now-unused `ObjCRuntime.IsILCompiler` feature switch plumbing.
### Validation
Ensure `tests/dotnet/MySimpleApp/{iOS,tvOS}` still publish cleanly both with and without `-p:PublishAot=true`, including the configuration where both ILLink and ILC process the XML.
### References
- Workaround PR: #26371
- Upstream issue: https://github.com/dotnet/runtime/issues/131601
Contributor guide
No contributing guide indexed for this repository
Research direction
After dotnet/runtime#131601 is fixed, compare PR #26371 with src/ILLink.Substitutions.iOS.xml, src/ILLink.Substitutions.tvOS.xml, and dotnet/targets/Xamarin.Shared.Sdk.targets. Remove the duplicated Arch substitutions, the ILC feature argument, and unused feature-switch plumbing while retaining the shared accepted value. Validate tests/dotnet/MySimpleApp/{iOS,tvOS} with and without -p:PublishAot=true, including the configuration where both ILLink and ILC process the XML.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, xml
- Domain
- build-system, tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100