Context
DotNetInstallAndRunMinorAPILevels(True, "net10.0-android36.1", CoreCLR) fails on macOS CI with the following error from CrossGen2 (ilc / R2R compilation) inside _CreateR2RImages:
Microsoft.NET.CrossGen.targets(501,5): error : Unhandled exception. System.CommandLine.CommandLineException: Target OS ''android'' is not supported
at System.CommandLine.Helpers.GetTargetOS(String) + 0x64a
at ILCompiler.Program.Main(String[] args) + 0xef
Scope
This affects net10.0-android* projects only. net11.0-android* projects (the default $(DotNetTargetFramework) on main) are fine because they pick up the matching .NET 11 SDK whose crossgen2 understands --targetos android.
CoreCLR-on-Android is experimental in .NET 10, so this is low priority — but it does break Release+CoreCLR builds targeting the older TFM on the new SDK.
Suspected cause
The .NET 10 SDK's R2R compiler (crossgen2 / ilc) does not recognise android as a valid --targetos. Microsoft.Android.Sdk.CoreCLR.targets:17 auto-enables PublishReadyToRun=true in Release+CoreCLR, which then routes through the SDK''s _CreateR2RImages target and invokes the in-box crossgen2. For a net10.0-android* project that picks up the .NET 10 crossgen2, which blows up; a net11.0-android* project picks up the .NET 11 crossgen2, which works.
The breakage surfaced after the dotnet/dotnet SDK bump in #11477.
Workaround applied
In #11477 the test was modified to set PublishReadyToRun=false for the CoreCLR matrix entry, so the test exercises Install+Run without R2R. The MonoVM and NativeAOT matrix entries are unaffected.
What to do here
Context
DotNetInstallAndRunMinorAPILevels(True, "net10.0-android36.1", CoreCLR)fails on macOS CI with the following error from CrossGen2 (ilc/ R2R compilation) inside_CreateR2RImages:Scope
This affects
net10.0-android*projects only.net11.0-android*projects (the default$(DotNetTargetFramework)onmain) are fine because they pick up the matching .NET 11 SDK whosecrossgen2understands--targetos android.CoreCLR-on-Android is experimental in .NET 10, so this is low priority — but it does break Release+CoreCLR builds targeting the older TFM on the new SDK.
Suspected cause
The .NET 10 SDK's R2R compiler (
crossgen2/ilc) does not recogniseandroidas a valid--targetos.Microsoft.Android.Sdk.CoreCLR.targets:17auto-enablesPublishReadyToRun=truein Release+CoreCLR, which then routes through the SDK''s_CreateR2RImagestarget and invokes the in-boxcrossgen2. For anet10.0-android*project that picks up the .NET 10crossgen2, which blows up; anet11.0-android*project picks up the .NET 11crossgen2, which works.The breakage surfaced after the dotnet/dotnet SDK bump in #11477.
Workaround applied
In #11477 the test was modified to set
PublishReadyToRun=falsefor the CoreCLR matrix entry, so the test exercises Install+Run without R2R. The MonoVM and NativeAOT matrix entries are unaffected.What to do here
net10.0-android*users to opt out of R2R explicitly may be acceptablecrossgen2to accept--targetos android, or have Mono.Android''s CoreCLR targets auto-disablePublishReadyToRunwhen targetingnet10.0-android*DotNetInstallAndRunMinorAPILevelsonce R2R works (or once we drop thenet10.0-android36.1matrix entry)