Skip to content

Commit 8f4bea9

Browse files
Cherry-pick in telemetry changes for 17.9 (#9559)
* Fix type check in IsComplexValue * Fix telemetry (again!) When reducing allocations in our telemetry, I inadvertently created one array to be too small, resulting in our correlation ID being overwritten for telemetry with three properties. --------- Co-authored-by: Dustin Campbell <[email protected]>
1 parent f956e66 commit 8f4bea9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Telemetry/TelemetryScope.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static TelemetryScope Create(ITelemetryReporter reporter, string name, Se
9393

9494
public static TelemetryScope Create(ITelemetryReporter reporter, string name, Severity severity, Property property1, Property property2, Property property3)
9595
{
96-
var array = new Property[3];
96+
var array = new Property[4];
9797
array[0] = property1;
9898
array[1] = property2;
9999
array[2] = property3;

src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Telemetry/TelemetryReporter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ private static void AddToProperties(IDictionary<string, object?> properties, Pro
9595
}
9696

9797
static bool IsComplexValue(object? o)
98-
=> o is Type type && Type.GetTypeCode(type) == TypeCode.Object;
98+
{
99+
return o?.GetType() is Type type && Type.GetTypeCode(type) == TypeCode.Object;
100+
}
99101
}
100102

101103
public void ReportFault(Exception exception, string? message, params object?[] @params)

0 commit comments

Comments
 (0)