Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions src/Tools/dotnet-counters/Exporters/ConsoleWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,33 @@ private bool RenderTagSetsInColumnMode(ref int row, ObservedCounter counter)
for (int i = 0; i < tags.Length; i++)
{
string tag = tags[i];
string[] keyValue = tag.Split("=");
int posTag = observedTags.FindIndex (tag => tag.header == keyValue[0]);
string[] keyValue = tag.Split(new char[] { '=' }, 2); // Split into at most 2 parts to handle values with '='

// Skip malformed tags that don't have both key and value
if (keyValue.Length != 2)
{
continue;
}

string key = keyValue[0].Trim();
string value = keyValue[1];

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider trimming the value as well to handle potential whitespace around the '=' delimiter, similar to how the key is trimmed. For example, if a tag is formatted as "key = value" with spaces around the equals sign, the value would currently preserve the leading space.

Suggested change
string value = keyValue[1];
string value = keyValue[1].Trim();

Copilot uses AI. Check for mistakes.

// Skip empty keys
if (string.IsNullOrEmpty(key))
{
continue;
}
Comment thread
steveisok marked this conversation as resolved.

int posTag = observedTags.FindIndex (tag => tag.header == key);
if (posTag == -1)
{
observedTags.Add((keyValue[0], new string[counter.TagSets.Count]));
columnHeaderLen.Add(keyValue[0].Length);
observedTags.Add((key, new string[counter.TagSets.Count]));
columnHeaderLen.Add(key.Length);
maxValueColumnLen.Add(default(int));
posTag = observedTags.Count - 1;
}
observedTags[posTag].values[tagsCount] = keyValue[1];
maxValueColumnLen[posTag] = Math.Max(keyValue[1].Length, maxValueColumnLen[posTag]);
observedTags[posTag].values[tagsCount] = value;
maxValueColumnLen[posTag] = Math.Max(value.Length, maxValueColumnLen[posTag]);
}
tagsCount++;
}
Expand Down
Loading