Skip to content

[tests] Restore previous Android SDK device coverage on .NET 12 - #13406

Merged
simonrozsival merged 2 commits into
mainfrom
jonathanpeppers-previous-sdk-device-coverage
Nov 6, 2026
Merged

simonrozsival merged 2 commits into
mainfrom
jonathanpeppers-previous-sdk-device-coverage

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Re-enable DotNetInstallAndRunPreviousSdk now that main targets .NET 12 and the previous target is .NET 11. Use a plain Android activity, JDK 21, the connected device's ABI, and the supported CoreCLR Debug/Release and NativeAOT Release configurations. Verify launch through a managed activity log message. Disable the previous workload's unsupported Android ReadyToRun path (#11719).

Local workload setup also needs to install Microsoft.Android.Sdk.net11 and clean old packs before installation; otherwise a previous-framework app fails with NETSDK1147 despite successful setup.

Fixes #12879

Validation

  • make prepare: passed. make all and make leeroy: solution/test compilation passed, but workload setup failed on missing Mono.Android.xml (an existing local-build prerequisite).
  • ./dotnet-local.sh build src/Mono.Android/Mono.Android.csproj -p:GenerateDocumentationFile=true -p:NoWarn=1591 -v:minimal and GenerateDocumentationFile=true ./dotnet-local.sh build Microsoft.Android.slnx -t:BuildExtraApiLevels -p:NoWarn=1591 -v:minimal: passed, generating the required XML.
  • ./dotnet-local.sh build build-tools/create-packs/Microsoft.Android.Sdk.proj -t:ConfigureLocalWorkload -v:minimal: passed with the provisioning fix; the previous SDK remains installed.
  • JAVA_HOME_21_ARM64=/Library/Java/JavaVirtualMachines/microsoft-21.jdk/Contents/Home ./dotnet-local.sh test bin/TestDebug/net11.0/Xamarin.Android.Build.Tests.dll --filter 'Name~MauiTargetFramework&Name~net11.0': passed, 2 tests, none skipped.
  • ./dotnet-local.sh build tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj --no-restore -v:minimal: passed. ./dotnet-local.sh test bin/TestDebug/MSBuildDeviceIntegration/net11.0/MSBuildDeviceIntegration.dll --list-tests: confirmed all three restored cases.
  • A standalone net11.0-android activity built with the local .NET 12 SDK for CoreCLR Debug/Release and NativeAOT Release. CoreCLR builds had no warnings; NativeAOT emitted the expected XA1040. APK inspection confirmed libcoreclr.so for CoreCLR and the compiled app .so for NativeAOT.

Device installation/launch could not be validated: a dedicated API 36.1 arm64 emulator remained offline with hvf is not enabled on this aarch64 host and qemu_mprotect__osdep: mprotect failed: Permission denied, including a retry with explicit HVF acceleration. No shared adb server or emulator was stopped.

jonathanpeppers and others added 2 commits November 5, 2026 13:59
Install and retain the previous Android SDK for local workload tests, use JDK 21 and supported runtime configurations, and verify managed activity startup without legacy Xamarin.Forms dependencies.

Co-authored-by: Copilot App <[email protected]>
Remove generated MSBuild assertions and duplicate startup waits; keep the managed activity log check and shorten supporting documentation.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 13:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

An offline emulator prevented validation of the restored cross-version installation and managed-activity launch tests across CoreCLR Debug/Release and NativeAOT Release.

No open issues 🎉

What changed in this PR

Restores previous-SDK device coverage on .NET 12 by testing net11.0-android applications, addressing #12879. Updates local workload provisioning to install and retain the previous Android SDK.

Changes:

  • Re-enables CoreCLR Debug/Release and NativeAOT Release tests using a plain activity, the connected device’s ABI, and a managed startup log message.
  • Shares JDK 21 discovery across tests and disables ReadyToRun for the previous-SDK test.
  • Installs Microsoft.Android.Sdk.net11 after cleaning old packs and documents test prerequisites.

Reported build validation passed after generating required documentation files; device installation and launch remain unvalidated because the emulator could not start.

File Description
tests/​MSBuildDeviceIntegration/​Tests/​InstallAndRunTests.cs Restores previous-SDK runtime cases and managed startup verification.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​XASdkTests.cs Removes the JDK helper now shared through BaseTest.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Utilities/​BaseTest.cs Provides shared JDK 21 discovery.
build-tools/​create-packs/​ConfigureLocalWorkload.targets Installs the previous Android SDK and moves cleanup before installation.
.github/​skills/​tests/​references/​test-catalog.md Documents restored configurations and JDK requirements.

Review effort: Balanced

@simonrozsival
simonrozsival merged commit a8b0c98 into main Nov 6, 2026
41 checks passed
@simonrozsival
simonrozsival deleted the jonathanpeppers-previous-sdk-device-coverage branch November 6, 2026 11:37
simonrozsival added a commit that referenced this pull request Nov 21, 2026
Context: #13613

A second, unchanged `make leeroy CONFIGURATION=Release` still redid work on every run:

  * The `GenerateWorkloadDependencies` target had no `Inputs`/`Outputs` and ran `dotnet run`, which re-evaluated, restored, and built `workload-dependencies.csproj` before regenerating `WorkloadDependencies.json` (~5-10 s per build). Build the generator with the `<MSBuild/>` task in the active configuration, run its DLL with `$(DotNetPreviewTool)`, and make the target incremental. The command-line arguments are written to a state file (`WriteOnlyWhenDifferent`) that is one of the target inputs, so property changes still regenerate. When the manifest feed is a remote URL, the state file is always rewritten, so the target always runs. `Microsoft.NET.Sdk.Android.proj` now forwards `$(DotNetPreviewTool)`.
  * `Xamarin.Android.Tools.Bytecode-Tests.targets` declared `classes/com/xamarin/module-info.class` as an output of the `BuildClasses` target, but `javac` writes module descriptors to the output root (`classes/module-info.class`). The missing output reran `javac` and the test project's C# compile on every build.
  * The `BuildExtraApiLevels` invocation in `BuildEverything.mk` restored `Microsoft.Android.slnx` again, although the preceding `leeroy` invocation just restored it. Pass `--no-restore`.
  * `eng/install-dotnet.sh` always ran `dotnet-install.sh`, which spends several seconds checking an SDK that is already installed. Exit early when `dotnet --list-sdks` already contains the exact pinned version.

`DeleteExtractedWorkloadPacks` (from #13406) still deletes and reinstalls `Microsoft.Android.Sdk.Darwin` from the feed on every `ConfigureLocalWorkload` run. That is intentional, so it is not changed here.

Validation on macOS arm64, Release, in a fresh worktree:

  * `make prepare CONFIGURATION=Release && make leeroy CONFIGURATION=Release`: succeeded.
  * A second `make leeroy CONFIGURATION=Release`: succeeded; `GenerateWorkloadDependencies` and `BuildClasses` were skipped as up to date.
  * `./dotnet-local.sh test tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj -c Release`: 132 passed, 2 skipped.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-enable previous Android SDK device test on .NET 12

3 participants