Repository navigation
Set apphost DOTNET_ROOT in InvokeTestingPlatform - #10413
Conversation
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 55a4038e-bf34-484a-a7a8-e888ca0336db
There was a problem hiding this comment.
Pull request overview
Aligns direct apphost launches with dotnet test runtime resolution.
Changes:
- Derives architecture-specific
DOTNET_ROOTfromDOTNET_HOST_PATH. - Preserves explicit overrides and adds an opt-out.
- Adds unit, acceptance, and changelog coverage.
Show a summary per file
| File | Description |
|---|---|
InvokeTestingPlatformTask.ToolResolution.cs |
Implements runtime-root selection and precedence. |
InvokeTestingPlatformTask.Execution.cs |
Applies configuration before launch. |
InvokeTestingPlatformTask.cs |
Adds the opt-out task property. |
Microsoft.Testing.Platform.MSBuild.targets |
Exposes and passes the opt-out property. |
InvokeTestingPlatformTaskTests.cs |
Tests core configuration behavior. |
MSBuildTests.Test.cs |
Adds end-to-end apphost coverage. |
Changelog-Platform.md |
Documents the behavior change. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Balanced
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Note
🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
Review Summary
This PR correctly implements DOTNET_ROOT_<ARCH> derivation from DOTNET_HOST_PATH for apphost launches in the InvokeTestingPlatform MSBuild target, matching dotnet test runtime resolution behavior. The implementation is well-structured with appropriate guard clauses and a clean opt-out mechanism.
✅ Strengths
- Algorithmic correctness: The precedence logic (explicit arch-specific > explicit
DOTNET_ROOT> derived) is sound. The Windows x86 special case correctly clears bothDOTNET_ROOT_X86andDOTNET_ROOT(x86)when only plainDOTNET_ROOTis supplied. - Public API surface:
TestingPlatformDisableAppHostDotnetRootis a simpleboolproperty (noinitaccessor) — appropriate for an MSBuild task property. This project does not usePublicAPI.Unshipped.txt(no API compat validation configured), so no file update is needed. - Localization: The
Log.LogMessage(MessageImportance.Low, ...)diagnostic string follows existing conventions in this project — other tasks use inline interpolated strings for diagnostic log messages rather than resx resources. - MSBuild authoring: The property default pattern (
Condition=" '$(...)' == '' ") and task attribute wiring are idiomatic. - Test coverage: Unit tests cover the key scenarios (automatic, explicit override, opt-out, incompatible architecture, Windows x86 detection via
[DataRow]). Integration test validates end-to-end behavior. - No
initaccessors on new public API ✅
💡 Minor observations (non-blocking)
-
TryGetRunCommand()called in guard: This method is called here as a guard and will be called again later duringbase.Execute(). It appears inexpensive (property checks + file existence), so this is acceptable but worth noting for future readers. -
Test coverage gap for Windows x86 + explicit
DOTNET_ROOT+ explicitDOTNET_ROOT(x86): The unit test covershasExplicitDotnetRoot=truebut not the combined case where bothDOTNET_ROOTandDOTNET_ROOT(x86)are explicitly set on a Windows x86 process (which should result in only clearing the arch-specific variable, notDOTNET_ROOT(x86)). This is a narrow edge case covered by the ternary logic but not explicitly tested. Non-blocking since theIsWindowsX86ProcessOn64BitOperatingSystemunit tests and the code path analysis confirm correctness.
Overall this is a clean, well-tested change. No blocking issues found.
🧪 Test quality grade — PR #10413
This advisory comment was generated automatically. Grades are heuristic and informational — they do not block merging. Re-run with
|
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 55a4038e-bf34-484a-a7a8-e888ca0336db
🧵 Parallel-safety audit — PR #10413Parallelization — one row per test assembly audited:
Findings: A (global-state) Nothing audited here touches process-global state, shared filesystem paths, or Why each new test is safe:
Advisory only — heuristic, non-blocking. Re-run with
|
There was a problem hiding this comment.
🤖 Automated content by GitHub Copilot. Generated by the Grade Tests on PR (on open / sync) workflow. · sonnet46 · 104.2 AIC · ⌖ 4.67 AIC · ⊞ 11.8K · ◷
|
Amaury Levé (@Evangelink) can I already start using this feature? Which feed do you publish to? |
Abosolutely! It's published to |
…OOT workaround microsoft/testfx#10413 makes InvokeTestingPlatformTask configure DOTNET_ROOT for app host launches automatically, so the inline task that set the variable on the MSBuild process is no longer needed. That fix isn't on the regular feeds yet, so pick it up from the testfx test-tools preview channel (https://aka.ms/mstest/preview) by overriding the Arcade default for MicrosoftTestingPlatformVersion. Both can be reverted once a release containing the fix flows to the regular feeds. Verified that the test applications still run against the repo-local .NET installation with no DOTNET_ROOT set in the environment. Co-authored-by: Copilot <[email protected]> Copilot-Session: 761287f0-d9eb-4740-974e-b168dab091a8
Summary
DOTNET_ROOT_<ARCH>fromDOTNET_HOST_PATHfor compatible direct apphost launchesTestingPlatformEnvironmentVariableoverrides, including clearing inherited higher-precedence roots when plainDOTNET_ROOTis suppliedTestingPlatformDisableAppHostDotnetRootopt-out and cover automatic, override, opt-out, architecture, and Windows x86 behaviorFixes #10408