Skip to content

Commit a15545b

Browse files
committed
Revert "Fix dotnet#1715"
This reverts commit 80f1e11.
1 parent 80f1e11 commit a15545b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/BenchmarkDotNet/Running/Descriptor.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,22 @@ public Descriptor(
5151
IterationCleanupMethod = iterationCleanupMethod;
5252
OperationsPerInvoke = operationsPerInvoke;
5353
AdditionalLogic = additionalLogic ?? string.Empty;
54-
WorkloadMethodDisplayInfo = description ?? workloadMethod?.Name ?? "Untitled";
54+
WorkloadMethodDisplayInfo = FormatDescription(description) ?? workloadMethod?.Name ?? "Untitled";
5555
Baseline = baseline;
5656
Categories = categories ?? Array.Empty<string>();
5757
MethodIndex = methodIndex;
5858
}
5959

6060
public override string ToString() => DisplayInfo;
6161

62+
private static string FormatDescription([CanBeNull] string description)
63+
{
64+
var specialSymbols = new[] { ' ', '\'', '[', ']' };
65+
return description != null && specialSymbols.Any(description.Contains)
66+
? "'" + description + "'"
67+
: description;
68+
}
69+
6270
public bool HasCategory(string category) => Categories.Any(c => c.EqualsWithIgnoreCase(category));
6371

6472
public string GetFilterName() => $"{Type.GetCorrectCSharpTypeName(includeGenericArgumentsNamespace: false)}.{WorkloadMethod.Name}";

0 commit comments

Comments
 (0)