Skip to content

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

@filzrev

Description

@filzrev

Currently following hierarchy are shown for BenchmarkDotNet.Samples when group by Project, Class.

Image

It show unintended 0 and 6 grouping.

It's caused by following workaround code for Rider/R#. (#2494)

// We use displayName as FQN to workaround the Rider/R# problem with FQNs processing
// See: https://github.com/dotnet/BenchmarkDotNet/issues/2494
var fullyQualifiedName = displayName;

It seems when FullyQualfiedName's dot(.) char. It's used for hierarchy separator.
So when job display name contains . char. It cause wrong grouping.


I've confirmed, It can be fixed by overwriting FQN value for VS.
But this workaround can't distinguish VS TestExplorer / Resharper's TestExplorer.

// Use benchmark method FQN on Visual Studio environment.
if (Environment.GetEnvironmentVariable("VSAPPIDNAME") != null)
{
   var benchmarkMethodName = benchmarkCase.Descriptor.WorkloadMethod.Name;
   var benchmarkFullMethodName = $"{fullClassName}.{benchmarkMethodName}";
   fullyQualifiedName = benchmarkFullMethodName;
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions