Skip to content

Commit 3a8992a

Browse files
authored
Avoid a couple string allocs in EventSource's ManifestBuilder ctor (#103744)
1 parent 78c82de commit 3a8992a

File tree

1 file changed

+5
-2
lines changed
  • src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing

1 file changed

+5
-2
lines changed

src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5158,8 +5158,11 @@ public ManifestBuilder(string providerName, Guid providerGuid, string? dllName,
51585158
if (dllName != null)
51595159
sb.Append($" resourceFileName=\"{dllName}\" messageFileName=\"{dllName}\"");
51605160

5161-
string symbolsName = providerName.Replace("-", "").Replace('.', '_'); // Period and - are illegal replace them.
5162-
sb.AppendLine($" symbol=\"{symbolsName}\">");
5161+
sb.Append(" symbol=\"");
5162+
int pos = sb.Length;
5163+
sb.Append(providerName); // Period and dash are illegal; replace them.
5164+
sb.Replace('.', '_', pos, sb.Length - pos).Replace("-", "", pos, sb.Length - pos);
5165+
sb.AppendLine("\">");
51635166
}
51645167

51655168
/// <summary>

0 commit comments

Comments
 (0)