Skip to content

[AndroidSdk] Add explicit emulator process environment - #13467

Merged
simonrozsival merged 1 commit into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers-emulator-process-preparation
Nov 11, 2026
Merged

simonrozsival merged 1 commit into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers-emulator-process-preparation

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Let EmulatorRunner copy a caller's environment and working directory. This prepares BootAndroidEmulator for MT support without changing existing caller behavior or enabling MT.

Move argument checks into the existing boot test instead of relying on 500 ms timeouts.

Tested on Windows: dotnet test tests\Xamarin.Android.Tools.AndroidSdk-Tests\Xamarin.Android.Tools.AndroidSdk-Tests.csproj --no-build --no-restore --filter FullyQualifiedName~EmulatorRunnerTests -v minimal — 25 passed. The two Unix-only checks were skipped.

Copy caller-provided environment and working directory without changing existing constructor behavior. Cover list and launch settings, and consolidate launch argument checks to avoid short boot-timeout races.

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

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

No active review issues are identified for the explicit process-environment support added to EmulatorRunner.

No open issues 🎉

What changed in this PR

Adds explicit process-environment support to EmulatorRunner, preparing BootAndroidEmulator for future multithreaded execution without enabling it or changing existing caller behavior.

Changes:

  • Adds a factory that copies the supplied environment and working directory for emulator launch and AVD listing.
  • Adds tests for copied and inherited process settings, and moves argument checks into the existing boot test instead of relying on short timeouts.
  • Records the new factory in all three public API baselines.
File Description
tests/​Xamarin.Android.Tools.AndroidSdk-Tests/​EmulatorRunnerTests.cs Tests process settings and consolidates boot argument checks.
src/​Xamarin.Android.Tools.AndroidSdk/​Runners/​EmulatorRunner.cs Copies and applies explicit process settings through a new factory.
src/​Xamarin.Android.Tools.AndroidSdk/​PublicAPI/​netstandard2.0/​PublicAPI.Unshipped.txt Declares the factory for .NET Standard 2.0.
src/​Xamarin.Android.Tools.AndroidSdk/​PublicAPI/​net11.0/​PublicAPI.Unshipped.txt Declares the factory for .NET 11.
src/​Xamarin.Android.Tools.AndroidSdk/​PublicAPI/​net10.0/​PublicAPI.Unshipped.txt Declares the factory for .NET 10.

Review effort: Balanced

@simonrozsival
simonrozsival enabled auto-merge (squash) November 11, 2026 06:12
@simonrozsival
simonrozsival merged commit 660f039 into dotnet:main Nov 11, 2026
40 checks passed
@jonathanpeppers

Copy link
Copy Markdown
Member Author

/backport to release/11.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

@jonathanpeppers backporting to release/11.0.1xx failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git cherry-pick 660f039f92f3fdda5c0a3422477651bdd2680e18

Auto-merging src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net10.0/PublicAPI.Unshipped.txt
CONFLICT (content): Merge conflict in src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net10.0/PublicAPI.Unshipped.txt
Auto-merging src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net11.0/PublicAPI.Unshipped.txt
CONFLICT (content): Merge conflict in src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net11.0/PublicAPI.Unshipped.txt
Auto-merging src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt
CONFLICT (content): Merge conflict in src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt
Auto-merging tests/Xamarin.Android.Tools.AndroidSdk-Tests/EmulatorRunnerTests.cs
error: could not apply 660f039f9... [AndroidSdk] Add explicit emulator process environment (#13467)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"


$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: [AndroidSdk] Add explicit emulator process environment
Using index info to reconstruct a base tree...
M	src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net10.0/PublicAPI.Unshipped.txt
M	src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net11.0/PublicAPI.Unshipped.txt
M	src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt
M	tests/Xamarin.Android.Tools.AndroidSdk-Tests/EmulatorRunnerTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net10.0/PublicAPI.Unshipped.txt
CONFLICT (content): Merge conflict in src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net10.0/PublicAPI.Unshipped.txt
Auto-merging src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net11.0/PublicAPI.Unshipped.txt
CONFLICT (content): Merge conflict in src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net11.0/PublicAPI.Unshipped.txt
Auto-merging src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt
CONFLICT (content): Merge conflict in src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt
Auto-merging tests/Xamarin.Android.Tools.AndroidSdk-Tests/EmulatorRunnerTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 [AndroidSdk] Add explicit emulator process environment
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

jonathanpeppers added a commit that referenced this pull request Nov 20, 2026
…ment (#13683)

Backport of #13467.

Add `EmulatorRunner.CreateWithProcessEnvironment` to copy a caller's complete process environment and working directory for emulator launch and AVD listing. Existing constructor behavior is unchanged.

Resolve the PublicAPI conflicts by adding only the new declaration to the release branch's netstandard2.0, net10.0, and net11.0 unshipped baselines. Preserve all existing release declarations. No issue is linked; #13467 is the source PR.

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.

3 participants