Skip to content

Commit d4e1845

Browse files
committed
chore: reflect reviewed content
1 parent cf466d3 commit d4e1845

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

src/BenchmarkDotNet/Disassemblers/ClrMdArgs.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using BenchmarkDotNet.Extensions;
2-
using BenchmarkDotNet.Serialization;
1+
using BenchmarkDotNet.Serialization;
32
using System.Linq;
43
using System.Text.Json.Serialization;
54

@@ -51,8 +50,5 @@ internal static ClrMdArgs FromArgs(string[] args)
5150

5251
internal readonly string Serialize()
5352
=> BdnJsonSerializer.Serialize(this);
54-
55-
public override string ToString()
56-
=> BdnJsonSerializer.Serialize(this, indentJson: true);
5753
}
5854
}

src/BenchmarkDotNet/Disassemblers/DisassemblyDiagnoser.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ InProcessDiagnoserHandlerData IInProcessDiagnoser.GetHandlerData(BenchmarkCase b
235235
{
236236
return default;
237237
}
238-
return new(typeof(DisassemblyDiagnoserInProcessHandler), BuildClrMdArgs(benchmarkCase, "", 0).Serialize());
238+
239+
var clrMdArgs = BuildClrMdArgs(benchmarkCase, "", 0);
240+
return new(typeof(DisassemblyDiagnoserInProcessHandler), BdnJsonSerializer.Serialize(clrMdArgs));
239241
}
240242

241243
void IInProcessDiagnoser.DeserializeResults(BenchmarkCase benchmarkCase, string results)

src/BenchmarkDotNet/Helpers/FolderNameHelper.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using BenchmarkDotNet.Extensions;
22
using Perfolizer.Horology;
3+
using SimpleJson.Reflection;
34
using System;
45
using System.Globalization;
56
using System.IO;
@@ -34,8 +35,8 @@ public static string ToFolderName(object? value)
3435
return value.ToString();
3536
if (value is Type type)
3637
return ToFolderName(type: type);
37-
if (!valueType.IsValueType)
38-
return valueType.Name; // TODO
38+
if (!ReflectionUtils.GetTypeInfo(valueType).IsValueType)
39+
return value.GetType().Name; // TODO
3940
if (value is TimeInterval interval)
4041
return interval.Nanoseconds + "ns";
4142

src/BenchmarkDotNet/Helpers/SourceCodeHelper.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using BenchmarkDotNet.Extensions;
2+
using Perfolizer.Horology;
3+
using SimpleJson.Reflection;
4+
using System;
35
using System.Diagnostics.CodeAnalysis;
46
using System.Globalization;
57
using System.Numerics;
6-
using BenchmarkDotNet.Extensions;
7-
using Perfolizer.Horology;
88

99
#nullable enable
1010

@@ -48,11 +48,11 @@ public static string ToSourceCode(object? value)
4848
}
4949
var valueType = value.GetType();
5050
if (valueType.IsEnum)
51-
return $"({value.GetType().GetCorrectCSharpTypeName()})({ToInvariantCultureString(value)})";
51+
return $"({valueType.GetCorrectCSharpTypeName()})({ToInvariantCultureString(value)})";
5252
if (value is Type type)
5353
return "typeof(" + type.GetCorrectCSharpTypeName() + ")";
54-
if (!valueType.IsValueType)
55-
return "System.Activator.CreateInstance<" + value.GetType().GetCorrectCSharpTypeName() + ">()";
54+
if (!ReflectionUtils.GetTypeInfo(valueType).IsValueType)
55+
return "System.Activator.CreateInstance<" + valueType.GetCorrectCSharpTypeName() + ">()";
5656

5757
switch (value) {
5858
case TimeInterval interval:

src/BenchmarkDotNet/Serialization/BdnJsonSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace BenchmarkDotNet.Serialization;
66

7-
public static partial class BdnJsonSerializer
7+
public static class BdnJsonSerializer
88
{
99
private static readonly JsonSerializerOptions DefaultOptions = new()
1010
{

0 commit comments

Comments
 (0)