in src/Sarif.Viewer.VisualStudio.Core/Models/SarifErrorListItem.cs [576:635]
internal void PopulateAdditionalPropertiesIfNot()
{
if (!SarifViewerPackage.IsUnitTesting)
{
#pragma warning disable VSTHRD108 // Assert thread affinity unconditionally
ThreadHelper.ThrowIfNotOnUIThread();
#pragma warning restore VSTHRD108
}
if (this.SarifResult.Locations?.Any() == true && this.Locations?.Any() == false)
{
// Adding in reverse order will make them display in the correct order in the UI.
for (int i = this.SarifResult.Locations.Count - 1; i >= 0; --i)
{
this.Locations.Add(this.SarifResult.Locations[i].ToLocationModel(this.SarifResult.Run, resultId: this.ResultId, runIndex: this.RunIndex));
}
}
if (this.SarifResult.RelatedLocations?.Any() == true && this.RelatedLocations?.Any() == false)
{
for (int i = this.SarifResult.RelatedLocations.Count - 1; i >= 0; --i)
{
this.RelatedLocations.Add(this.SarifResult.RelatedLocations[i].ToLocationModel(this.SarifResult.Run, resultId: this.ResultId, runIndex: this.RunIndex));
}
}
if (this.SarifResult.Stacks?.Any() == true && this.Stacks?.Any() == false)
{
foreach (Stack stack in this.SarifResult.Stacks)
{
this.Stacks.Add(stack.ToStackCollection(resultId: this.ResultId, runIndex: this.RunIndex));
}
}
if (this.SarifResult.CodeFlows?.Any() == true && this.AnalysisSteps?.Any() == false)
{
foreach (CodeFlow codeFlow in this.SarifResult.CodeFlows)
{
var analysisStep = codeFlow.ToAnalysisStep(this.SarifResult.Run, resultId: this.ResultId, runIndex: this.RunIndex);
if (analysisStep != null)
{
this.AnalysisSteps.Add(analysisStep);
}
}
this.AnalysisSteps.Verbosity = 100;
this.AnalysisSteps.IntelligentExpand();
}
if (this.SarifResult.PropertyNames?.Any() == true && this.Properties?.Any() == false)
{
foreach (string propertyName in this.SarifResult.PropertyNames)
{
this.Properties.Add(
new KeyValuePair<string, string>(
propertyName,
this.SarifResult.GetSerializedPropertyValue(propertyName)));
}
}
}