Skip to content

Mark the xxHash128 test id API as experimental - #16465

Merged
Jakub Jareš (nohwnd) merged 7 commits into
microsoft:mainfrom
azat-msft:azat-msft-experimental-xxhash128-api
Sep 25, 2026
Merged

Jakub Jareš (nohwnd) merged 7 commits into
microsoft:mainfrom
azat-msft:azat-msft-experimental-xxhash128-api

Conversation

@azat-msft

Copy link
Copy Markdown
Member

#16378 added the xxHash128 test case id API as public API:

  • EqtHash.GuidFromStringXxHash128(string)
  • TestIdProviderXxHash128

It ships available but not default — xxHash128 is only used when a run opts in through
VSTEST_DISABLE_XXHASH128_TESTCASE_ID. The point of shipping it that way is to gather feedback
before the default flips.

That API is now heading into an LTS release, where public API is supported for the life of the
release. We do not want to commit to supporting a shape we are still collecting feedback on. This
marks both members [Experimental("VSTEST001")], which makes every use a compile error unless the
caller opts in with <NoWarn>VSTEST001</NoWarn> (or a pragma). The intent is to drop the attribute
once the LTS branch is forked; that is a metadata-only change, so it is not breaking.

The SHA1 API (EqtHash.GuidFromString, TestIdProvider) is deliberately untouched — it is
shipped, supported, and still what test ids are computed with.

Docs now say plainly that xxHash128 is not supported yet.

Notes for the reviewer

The polyfill. ExperimentalAttribute only exists from .NET 8 onwards, and both ObjectModel and
AdapterUtilities also build net462 and netstandard2.0. Hashing.Source/ExperimentalAttribute.cs
declares an internal copy under #if !NET8_0_OR_GREATER. The compiler binds the attribute by full
name rather than by identity, so the internal copy produces the same diagnostic the framework type
would — including for consumers compiling against the shipped net462 assembly.

CS0436 in CrossPlatEngine. ObjectModel's internal copy is visible to CrossPlatEngine through
InternalsVisibleTo, where it collided with the identical polyfill that
Microsoft.Testing.Platform.ServerMode.Client.Sources compiles in. That package has an opt-out
constant for exactly this, and CrossPlatEngine already uses its sibling for the nullable attributes,
so MTP_CLIENT_EXCLUDE_EXPERIMENTAL_ATTRIBUTE is added next to
MTP_CLIENT_EXCLUDE_NULLABLE_ATTRIBUTES.

Suppressions. Product code uses a #pragma around the single call site, so a new accidental use
still fails the build. The test projects and the two binding-guard test assets use NoWarn, since
exercising this API is their whole job.

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 experimental marking is applied consistently with appropriate downlevel support, and intentional usages are correctly suppressed in product code/tests/docs without introducing additional behavioral changes.

Pull request overview

This PR marks the newly introduced xxHash128-based test case ID APIs as experimental so they don’t become an LTS-supported public contract while feedback is still being collected. It does this by applying [Experimental("VSTEST001")] and ensuring downlevel TFMs (net462/netstandard2.0) can compile via an internal polyfill, while updating call sites/tests/docs accordingly.

Changes:

  • Annotate EqtHash.GuidFromStringXxHash128(string) and TestIdProviderXxHash128 with [Experimental("VSTEST001")], with localized suppressions at the intentional product call sites.
  • Add a downlevel ExperimentalAttribute polyfill and prevent CS0436 collisions in CrossPlatEngine by excluding the MTP client’s duplicate polyfill type.
  • Update docs and test/test-asset projects to suppress VSTEST001 where usage is intentional.
File summaries
File Description
test/TestAssets/DtaLikeHost/DtaLikeHost.csproj Suppresses VSTEST001 for the binding/host asset that intentionally exercises the experimental path.
test/TestAssets/AdapterUtilitiesBindingHost/AdapterUtilitiesBindingHost.csproj Suppresses VSTEST001 for the binding/host asset that intentionally exercises the experimental path.
test/Microsoft.TestPlatform.ObjectModel.UnitTests/Microsoft.TestPlatform.ObjectModel.UnitTests.csproj Suppresses VSTEST001 in ObjectModel unit tests that intentionally call the experimental API.
test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/Microsoft.TestPlatform.AdapterUtilities.UnitTests.csproj Extends existing NoWarn to include VSTEST001 for tests that intentionally use the experimental API.
src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs Marks GuidFromStringXxHash128 experimental and documents its support status.
src/Microsoft.TestPlatform.ObjectModel/TestCase.cs Uses targeted #pragma suppression for the deliberate experimental call gated by the algorithm selection.
src/Microsoft.TestPlatform.Hashing.Source/README.md Documents the experimental/support status and the downlevel polyfill approach.
src/Microsoft.TestPlatform.Hashing.Source/ExperimentalAttribute.cs Adds internal downlevel polyfill for ExperimentalAttribute for non-.NET 8 TFMs.
src/Microsoft.TestPlatform.CrossPlatEngine/Microsoft.TestPlatform.CrossPlatEngine.csproj Excludes the MTP client’s duplicate experimental attribute polyfill to avoid CS0436 conflicts.
src/Microsoft.TestPlatform.CrossPlatEngine/Client/MTP/MtpTestNodeConverter.cs Uses targeted #pragma suppression for the deliberate experimental call mirroring TestCase behavior.
src/Microsoft.TestPlatform.AdapterUtilities/TestIdProviderXxHash128.cs Marks TestIdProviderXxHash128 experimental and documents its support status.
docs/environment-variables.md Clarifies that xxHash128 is not supported yet and may change or be removed.
Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings September 10, 2026 11:32

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.

🟡 Changes recommended

The new ExperimentalAttribute polyfill is missing a required using System;, which will break compilation on down-level TFMs.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 1
  • Review effort level: Lite

The xxHash128 test case id API ships available but not default, to gather
feedback. It would otherwise go out in an LTS release as supported API.
Annotating it [Experimental("VSTEST001")] makes every use a compile error
unless the caller opts in, and removing the attribute later is metadata only,
so it is not a breaking change.

ExperimentalAttribute only exists from .NET 8 onwards and both consuming
projects also build net462 and netstandard2.0, so an internal polyfill is
added to the shared hashing source under #if !NET8_0_OR_GREATER. The compiler
binds the attribute by full name, not identity, so the internal copy reports
the same diagnostic.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 398d9f0e-8f18-4ec4-a135-da39f2447719
The section restated what the XML doc comments and the environment variable
docs already say, in a README whose subject is the vendored source rather than
API policy. The polyfill stays documented where it belongs, as a row in the
table of files.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 398d9f0e-8f18-4ec4-a135-da39f2447719
The logger is public API heading into the same LTS release as the xxHash128 id
API, and it is explicitly temporary - it is deleted together with the SHA1
implementation it reports on. Annotating it [Experimental("VSTEST001")] keeps
publishing it from committing us to supporting it. Running it with
/logger:testids is unaffected, because that path is reflection rather than a
compile time reference.

The assembly declares its own copy of the down-level ExperimentalAttribute
rather than picking up ObjectModel's internal one through InternalsVisibleTo.
Its netstandard2.0 build runs against ObjectModel's net8.0 build, which compiles
that copy out, so a type reference into ObjectModel resolved at compile time but
not at run time. Reflecting over the logger's attributes then threw and
extension discovery silently dropped it, which the acceptance tests caught as
"Could not find a test logger with FriendlyName 'testids'" on .NET while the
.NET Framework rows still passed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 398d9f0e-8f18-4ec4-a135-da39f2447719
Copilot AI review requested due to automatic review settings September 10, 2026 13:30
@azat-msft
Azat Mukhametshin (azat-msft) force-pushed the azat-msft-experimental-xxhash128-api branch from b9fd9bd to f621efc Compare September 10, 2026 13:30

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 changes are primarily metadata/documentation and narrowly-scoped suppressions consistent with the stated goal of keeping the API experimental without altering default runtime behavior.

Review details
  • Files reviewed: 17/17 changed files
  • Comments generated: 1
  • Review effort level: Lite

The comment conflated build-time reference resolution with runtime assembly
loading. The netstandard2.0 leg compiles against ObjectModel's netstandard2.0
target, which does declare the polyfill, so the build-time story is fine. The
failure is at runtime, where a netstandard2.0 extension loaded into a .NET host
sees ObjectModel's net8.0 assembly with the polyfill compiled out.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af1371f0-1ff1-404c-87a6-1db59c33b8e1
Copilot AI review requested due to automatic review settings September 17, 2026 15:21

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.

🟡 Changes recommended

The logger’s xxHash128 call lacks the required suppression and causes a warnings-as-errors build failure.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 17/17 changed files
  • Comments generated: 1
  • Review effort level: Lite

Move ExperimentalAttribute.cs from Hashing.Source to shared/, next to
NullableAttributes.cs, which is where cross-assembly BCL polyfills already live
and which every consumer here already links from. It is not hashing source, and
keeping it there relied on the silent glob pickup that folder's README warns
about, left it outside that folder's vendored-code .editorconfig scope, and
contradicted the README rule preferring one shared copy over several.

Add docs/experimental-apis.md describing what VSTEST001 covers and how to
suppress it, and point UrlFormat at it so the compiler error is actionable
rather than a bare identifier.

Move the support status into the environment variable Description, matching the
neighbouring VSTEST_DISABLE_MTP_TESTHOST entry, so it is read rather than
buried in the last bullet.

Note at the unsuppressed call site in TestIdsLogger that Roslyn does not report
experimental diagnostics inside an [Experimental] context, and that this is not
matched on the diagnostic id.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af1371f0-1ff1-404c-87a6-1db59c33b8e1
…ribute

The UrlFormat fragment was composed from {0}, which expands to the diagnostic
id verbatim - uppercase. GitHub generates lowercase heading anchors, so
"#VSTEST001" matched nothing and the help link dropped the reader at the top of
the page. Hardcode "#vstest001" and drop the explicit anchor element that was
added to work around it, which never applied either.

Add tests pinning [Experimental] on all three APIs. Nothing caught its silent
loss: the PublicAPI analyzer records signatures rather than attributes, and the
NoWarn entries keep passing whether the annotation is there or not, so the whole
point of this change could regress unnoticed.

Explain why CrossPlatEngine may borrow ObjectModel's polyfill while the test ids
logger may not - it never ships a netstandard2.0 asset - since the two comments
otherwise argue opposite things. Correct the claim that the define is a no-op on
net8.0, where it also drops a TypeForwardedTo. Link the new document from the
README and from the logger's Related section.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af1371f0-1ff1-404c-87a6-1db59c33b8e1
Copilot AI review requested due to automatic review settings September 17, 2026 16:05
@azat-msft

Copy link
Copy Markdown
Member Author

Copilot review

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.

🟡 Changes recommended

Correct the VSTEST001 diagnostic URL fragment to use the documented lowercase anchor.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 23/23 changed files
  • Comments generated: 1
  • Review effort level: Lite

This site kept the "#{0}" fragment while the other two were fixed, so the help
link in its diagnostic still landed at the top of the page instead of the
VSTEST001 section. The fix was written but lost to a git checkout during an
unrelated verification step and committed in the reverted state.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af1371f0-1ff1-404c-87a6-1db59c33b8e1
Copilot AI review requested due to automatic review settings September 17, 2026 16:18
@azat-msft

Copy link
Copy Markdown
Member Author

Copilot review

This was referenced Nov 27, 2026
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.

4 participants