Report raw invalid IsTargetPlatformInferred value, cover host x64 forcing - #16295
Merged
Jakub Jareš (nohwnd) merged 2 commits intoJul 21, 2026
Merged
Jakub Jareš (nohwnd) merged 2 commits into
Jakub Jareš (nohwnd) merged 2 commits into
Conversation
Follow-up to the review on microsoft#16271. The SettingsException for an invalid <IsTargetPlatformInferred> reported the parsed bool (always False) instead of the value the user wrote. Report the raw text, like the other RunConfiguration bool elements do. Add DotnetTestHostManager coverage that pins the target platform (IsTargetPlatformInferred=false) and proves the host is not silently forced to x64, while an inferred platform still is. 🤖
Contributor
There was a problem hiding this comment.
Pull request overview
This PR is a follow-up to #16271 that improves RunSettings validation diagnostics and adds targeted regression coverage around DotnetTestHostManager host/muxer architecture selection when <IsTargetPlatformInferred> is present/absent.
Changes:
- Fix
RunConfiguration.FromXmlto report the raw invalid<IsTargetPlatformInferred>value in the thrownSettingsException(instead of the default parsedboolvalue). - Extend
RunConfigurationTeststo assert the exception message includes the user-provided invalid text. - Add a
DotnetTestHostManagerunit test that verifies x64 muxer forcing happens only when the target platform was inferred, and not when explicitly pinned.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs | Adds regression coverage ensuring x64 muxer forcing depends on <IsTargetPlatformInferred> when simulating OSX ARM64 + pre-net6 target. |
| test/Microsoft.TestPlatform.ObjectModel.UnitTests/RunSettings/RunConfigurationTests.cs | Updates the invalid-value test to assert the exception reports the raw text the user provided. |
| src/Microsoft.TestPlatform.ObjectModel/RunSettings/RunConfiguration.cs | Changes the exception formatting to use the raw element content for invalid <IsTargetPlatformInferred> values. |
Tighten the invalid-value test to check the complete SettingsException message instead of a substring, matching the invalid-value tests for the other RunConfiguration bool settings. This also keeps the test identical to the one in the sibling follow-up PR so the two branches merge without a conflict. 🤖
github-actions Bot
added a commit
that referenced
this pull request
Jul 22, 2026
…ters settings exceptions Follow-up to #16295 which fixed the same issue for IsTargetPlatformInferred. When bool.TryParse fails, boolValue is always False regardless of what the user wrote. The error message should report element (the raw user input) so the diagnostic is actionable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Sep 9, 2026
Closed
This was referenced Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the review on #16271.
Two things from Amaury's review:
The
SettingsExceptionfor an invalid<IsTargetPlatformInferred>reported the parsed bool (alwaysFalse) instead of the value the user actually wrote. It now reports the raw text, the same way the other RunConfiguration bool elements do.Added
DotnetTestHostManagercoverage that pins the target platform (<IsTargetPlatformInferred>false</IsTargetPlatformInferred>) and proves the host is not silently forced to x64, while an inferred platform still is. The test simulates osx-arm64 on a pre-net6.0 target so it stays off the Windows testhost.exe path and is deterministic on every CI OS.Verified locally in Release: RunConfiguration tests (29), TestHostProvider.UnitTests (117), ObjectModel.UnitTests (208) all pass.
🤖