Refactor GetManifestForRegisteredProvider to use XmlWriter#2353
Refactor GetManifestForRegisteredProvider to use XmlWriter#2353
Conversation
|
@copilot, the new test is failing with the following error: |
... Fixed in commit c485a84. The issue was that stringIds (like |
|
@copilot, I've made a bunch of changes locally. Please update the PR description. |
Updated the PR description to reflect the changes made in commits 657a433, ab5f160, and 554069f: Key updates:
The new description better reflects the current state of the PR with your improvements. |
Replace hand-crafted XML string concatenation with XmlWriter for proper XML generation. Add comparison tests against a copy of the legacy implementation to validate output equivalence. Changes: - New XmlWriter-based implementation using structured data classes (EventData, TemplateData, DataField, MapData, MapEntry, StringTableEntry) - Fix: events with multiple versions are now all preserved (List<EventData>) - Fix: proper XML escaping via XmlWriter instead of manual escaping - Legacy implementation preserved in test file for comparison testing - Tests for Microsoft-JScript, Microsoft-Windows-Ntfs, and Microsoft-Windows-DotNETRuntime providers
554069f to
d08077e
Compare
The
GetManifestForRegisteredProvidermethod hand-crafted XML through string concatenation and manual escaping. This refactoring replaces it withXmlWriterfor better maintainability while ensuring identical output to the original implementation.Changes
RegisteredTraceEventParser.cs
EventData,TemplateData,DataField,MapData,MapEntry,StringTableEntry) to collect manifest data before serialization.StringWriter-based XML concatenation withXmlWriter, which handles element nesting, attribute escaping, and namespace declarations automatically.XmlUtilities.XmlEscapecalls that would have caused double-escaping when combined withXmlWriter.mapattribute (only the first field to discover a map received it).TemplateKeyclass implementingIEquatable<TemplateKey>for collision-free template deduplication.usingdirectives (System.Linq,Microsoft.Diagnostics.Utilities).RegisteredTraceEventParserTests.cs
GetManifestForRegisteredProvider_NoDoubleEscapedEntities: verifies no double-escaped XML entities in output and semantically compares string table entries between new and legacyimplementations.
GetManifestForRegisteredProvider_NewAndLegacyImplementationsProduceSameOutput: normalizes and compares full XML output against a legacy reference implementation(Microsoft-JScript provider).
GetManifestForRegisteredProvider_DotNETRuntime_NewAndLegacyMatch: same comparison for the complex Microsoft-Windows-DotNETRuntime provider.NormalizeTemplateNames,RemoveNonSignificantTextNodes,SortAttributes) to handle formatting differences and template naming order betweenimplementations.