Skip to content

Commit

Permalink
Avoid possible key collection in analyzer telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Nov 21, 2024
1 parent b15ca1f commit aa3df16
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ private async Task<SerializableDiagnosticAnalysisResults> AnalyzeAsync(
projectAnalyzers, hostAnalyzers, skippedAnalyzersInfo, reportSuppressedDiagnostics, cancellationToken).ConfigureAwait(false));
}

// TODO Does this need adjustment?
var telemetry = getTelemetryInfo
? GetTelemetryInfo(analysisResult, projectAnalyzers, hostAnalyzers, analyzerToIdMap)
: [];
Expand Down Expand Up @@ -462,21 +461,9 @@ private async Task<SerializableDiagnosticAnalysisResults> AnalyzeAsync(
}

using var _2 = ArrayBuilder<(string analyzerId, AnalyzerTelemetryInfo)>.GetInstance(out var telemetryBuilder);
if (analysisResult?.ProjectAnalysisResult is not null)
{
foreach (var (analyzer, analyzerTelemetry) in analysisResult.ProjectAnalysisResult.AnalyzerTelemetryInfo)
{
if (shouldInclude(analyzer))
{
var analyzerId = GetAnalyzerId(analyzerToIdMap, analyzer);
telemetryBuilder.Add((analyzerId, analyzerTelemetry));
}
}
}

if (analysisResult?.HostAnalysisResult is not null)
if (analysisResult is not null)
{
foreach (var (analyzer, analyzerTelemetry) in analysisResult.HostAnalysisResult.AnalyzerTelemetryInfo)
foreach (var (analyzer, analyzerTelemetry) in analysisResult.MergedAnalyzerTelemetryInfo)
{
if (shouldInclude(analyzer))
{
Expand Down

0 comments on commit aa3df16

Please sign in to comment.