Skip to content

Fix #2793: Use proper FQN in VS Test Explorer to avoid hierarchy split#2978

Merged
timcassell merged 1 commit intodotnet:masterfrom
Shrinidhi203:fix-issue-2793
Jan 27, 2026
Merged

Fix #2793: Use proper FQN in VS Test Explorer to avoid hierarchy split#2978
timcassell merged 1 commit intodotnet:masterfrom
Shrinidhi203:fix-issue-2793

Conversation

@Shrinidhi203
Copy link
Contributor

@Shrinidhi203 Shrinidhi203 commented Jan 24, 2026

  • Fix incorrect VS Test Explorer hierarchy when job display name contains . (e.g., ".NET 8.0.6")
  • Detect Visual Studio environment via VSAPPIDNAME environment variable
  • Use benchmark method FQN instead of displayName for test case in VS, preventing dots in job names from being
    misinterpreted as namespace separators
  • Preserve existing Rider/R# workaround (Rider and R# do not distinguish parametrized TestAdapter cases #2494) for non-VS environments

Test plan

  • Manual testing: Verify in VS Test Explorer that benchmarks with multi-version jobs (containing dots in names
    like ".NET 8.0.6") display correct hierarchy without unintended grouping

Why no automated tests

The ToVsTestCase extension method and BenchmarkCaseExtensions class are internal to the
BenchmarkDotNet.TestAdapter assembly. Adding unit tests would require exposing internals via InternalsVisibleTo,
which introduces cross-project dependencies and framework compatibility complexity between TestAdapter
(netstandard2.0) and the test project. Since the fix is straightforward and follows the exact pattern suggested in
the issue, manual verification in VS Test Explorer is sufficient.

…y split

When job display name contains '.' (e.g., '.NET 8.0.6'), VS Test Explorer
interprets it as a namespace separator, causing incorrect hierarchy grouping.

Detect Visual Studio environment via VSAPPIDNAME env variable and use
the benchmark method FQN instead of displayName for the test case.
@timcassell
Copy link
Collaborator

@filzrev Can you verify this?

@filzrev
Copy link
Contributor

filzrev commented Jan 27, 2026

I've tested on local VS environment.
And #2793 issue seems be resolved by this PR.

I've not tested on Rider and Resharper environment.
Because these tests seems not discover benchmarks on test explorer.

Copy link
Collaborator

@timcassell timcassell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@timcassell timcassell merged commit 153e400 into dotnet:master Jan 27, 2026
11 checks passed
@timcassell timcassell added this to the v0.16.0 milestone Jan 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.

Wrong benchmark hierarchy shown on VS TestExplorer when job display name contains .

3 participants