Skip to content

[Xamarin.Android.Build.Debugging.Tasks] Enable MT CPU detection - #13466

Merged
simonrozsival merged 1 commit into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers-mt-primary-cpu-detection
Nov 11, 2026
Merged

simonrozsival merged 1 commit into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers-mt-primary-cpu-detection

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

GetPrimaryCpuAbi runs in a task host with -mt. Use MultithreadedAndroidTask and TaskEnvironment for adb and the device cache so it can run in-process.

Tested with the locally built Release SDK, including ordinary and strict MT task execution:

  • dotnet-local.cmd test bin\TestRelease\net11.0\Xamarin.Android.Build.Tests.dll --filter FullyQualifiedName~AppDetectionTests — 13 passed.
  • bin\Release\dotnet\dotnet.exe test tests\Microsoft.Android.Build.BaseTasks-Tests -c Release --no-restore — 159 passed.

Run GetPrimaryCpuAbi in-process with multithreaded MSBuild instead of a task host. Use TaskEnvironment for adb and device-cache paths.

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

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.

🟢 Approval recommended

The review identifies no active issues with the in-process CPU detection and environment-aware XML saving changes.

No open issues 🎉

What changed in this PR

Enables GetPrimaryCpuAbi to run in-process during multithreaded MSBuild execution, using project-specific environments for ADB and device-cache access.

Changes:

  • Migrates CPU detection to MultithreadedAndroidTask while preserving cancellation support.
  • Adds environment-aware XML saving for project-relative paths and file-write retry settings.
  • Expands tests for strict multithreaded execution, cache reuse, environment isolation, and cancellation.
File Description
tests/​Microsoft.Android.Build.BaseTasks-Tests/​FilesTests.cs Tests XML save paths, retry settings, and unchanged-file timestamps.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​AppDetectionTests.cs Adds CPU detection coverage and strengthens multithreaded validation.
src/​Xamarin.Android.Build.Debugging.Tasks/​Tasks/​GetPrimaryCpuAbi.cs Enables in-process execution with project-scoped ADB and cache access.
src/​Microsoft.Android.Build.BaseTasks/​XDocumentExtensions.cs Adds a TaskEnvironment-aware SaveIfChanged overload.

Review effort: Balanced

@simonrozsival
simonrozsival merged commit 32abca3 into dotnet:main Nov 11, 2026
40 checks passed
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.

3 participants