Skip to content

Report raw invalid IsTargetPlatformInferred value, cover host x64 forcing - #16295

Merged
Jakub Jareš (nohwnd) merged 2 commits into
microsoft:mainfrom
nohwnd:nohwnd-address-amaury-review-16271
Jul 21, 2026
Merged

Report raw invalid IsTargetPlatformInferred value, cover host x64 forcing#16295
Jakub Jareš (nohwnd) merged 2 commits into
microsoft:mainfrom
nohwnd:nohwnd-address-amaury-review-16271

Conversation

@nohwnd

Copy link
Copy Markdown
Member

Follow-up to the review on #16271.

Two things from Amaury's review:

  • The SettingsException for an invalid <IsTargetPlatformInferred> reported the parsed bool (always False) instead of the value the user actually wrote. It now reports the raw text, the same way the other RunConfiguration bool elements do.

  • Added DotnetTestHostManager coverage 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.

🤖

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.

🤖
Copilot AI review requested due to automatic review settings July 20, 2026 11:40

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.

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.FromXml to report the raw invalid <IsTargetPlatformInferred> value in the thrown SettingsException (instead of the default parsed bool value).
  • Extend RunConfigurationTests to assert the exception message includes the user-provided invalid text.
  • Add a DotnetTestHostManager unit 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.

🤖
Copilot AI review requested due to automatic review settings July 21, 2026 08:46

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@nohwnd
Jakub Jareš (nohwnd) merged commit e61a77b into microsoft:main Jul 21, 2026
20 checks passed
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>
github-actions Bot added a commit to secana/PeNet that referenced this pull request Sep 10, 2026
Updated [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest)
from 18.9.0 to 18.10.0.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.NET.Test.Sdk's
releases](https://github.com/microsoft/vstest/releases)._

## 18.10.0


## What's Changed
* Drop Mono fallback, run .NET Framework tests on Windows only by
@​nohwnd in microsoft/vstest#16158
* Run Microsoft.Testing.Platform test apps under `vstest.console` and
datacollector by @​nohwnd in
microsoft/vstest#16201
* Fix test output eaten by MSBuild terminal logger by @​nohwnd in
microsoft/vstest#16223
* Remove the experimental test session feature by @​nohwnd in
microsoft/vstest#16231
* Skip a single bad executor instead of failing all executor loading by
@​nohwnd in microsoft/vstest#16239
* Assert apartment state instead of using Clipboard in UI tests by
@​nohwnd in microsoft/vstest#16270
* Surface test host crashes during protocol negotiation by @​nohwnd in
microsoft/vstest#16285
* Pass the inferred target platform to the host in run settings by
@​nohwnd in microsoft/vstest#16271
* Report raw invalid IsTargetPlatformInferred value, cover host x64
forcing by @​nohwnd in microsoft/vstest#16295
* Disable the MTP testhost by default (#​16337) by @​nohwnd in
microsoft/vstest#16341


**Full Changelog**:
microsoft/vstest@v18.9.0...v18.10.0

Commits viewable in [compare
view](microsoft/vstest@v18.9.0...v18.10.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Microsoft.NET.Test.Sdk&package-manager=nuget&previous-version=18.9.0&new-version=18.10.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>
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.

2 participants