perfview icon indicating copy to clipboard operation
perfview copied to clipboard

Fix duplicate stringTable elements in instrumentation manifest

Open Copilot opened this issue 1 month ago • 1 comments

  • [x] Investigate and understand the root cause of duplicate stringTable elements in GetManifestForRegisteredProvider()
  • [x] Implement fix using HashSet to track emitted string IDs
  • [x] Replace string.Format calls with string interpolation
  • [x] Add unit test to verify no duplicate string IDs in stringTable
  • [x] Build the changes
  • [x] Run code review
  • [x] Run security analysis with CodeQL
Original prompt

This section details on the original issue you should resolve

<issue_title>instrumentation manifest - duplicate stringTable elements</issue_title> <issue_description>The stringTable in the instrumentation manifest generated by GetManifestForRegisteredProvider() can have duplicate elements.

e.g. Microsoft-JScript provider's manifest includes -

<string id="map_MethodAddressRangeMapJITLoopBody" value="JITLoopBody" />        
<string id="map_MethodAddressRangeMapJITLoopBody" value="JITLoopBody" />        
<string id="map_MethodAddressRangeMapJITLoopBody" value="JITLoopBody" />        
<string id="map_MethodAddressRangeMapJITLoopBody" value="JITLoopBody" />        
<string id="map_MethodAddressRangeMapJITLoopBody" value="JITLoopBody" />        
<string id="map_MethodAddressRangeMapJITLoopBody" value="JITLoopBody" />        
<string id="map_MethodAddressRangeMapJITLoopBody" value="JITLoopBody" />        
<string id="map_MethodAddressRangeMapJITLoopBody" value="JITLoopBody" />
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

  • Fixes microsoft/perfview#1069

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Dec 05 '25 16:12 Copilot

@copilot, please address these comments.

Also, please add a new unit test that validates that the fix works. Use a provider that is known to exist on all machines, such as "Microsoft-Windows-DotNETR...

Addressed the string interpolation comment and added a new unit test GetManifestForRegisteredProvider_NoDuplicateStringTableEntries that validates no duplicate string IDs exist in the generated manifest. The test uses Microsoft-Windows-DotNETRuntime provider and is marked as Windows-only using [WindowsFact] since GetManifestForRegisteredProvider requires Windows TDH APIs. See commit a0fb478.

Copilot avatar Dec 05 '25 17:12 Copilot