DumpRegisteredManifest and RegisteredTraceEventParser.GetManifestForRegisteredProvider generate invalid XML
For a couple of registered providers on my machine, DumpRegisteredManifest and RegisteredTraceEventParser.GetManifestForRegisteredProvider generate invalid XML.
One example of this is Microsoft-Windows-Ntfs, {3ff37a1c-a68d-4d6e-8c9b-f79e8b16c482}.
The offending XML can be generated with perfview from the command-line like this:
perfview.exe /noGUI /LogFile:log.txt userCommand DumpRegisteredManifest Microsoft-Windows-Ntfs
The output of RegisteredTraceEventParser.GetManifestForRegisteredProvider is similar.
The issue is that some attributes contain invalid XML characters, in the case of Microsoft-Windows-Ntfs, double quotes ("). The invalid XML occurs in two places:
Maps section:
<valueMap name="VolumeCorruptionActionState">
<map value="0x0" message="$(string.map_VolumeCorruptionActionStateis healthy. No action is needed.)"/>
<map value="0x1" message="$(string.map_VolumeCorruptionActionStaterequires an Online Scan. An Online Scan will automatically run as part of the next scheduled maintenance task. Alternatively you may run "CHKDSK /SCAN" locally via the command line, or run "REPAIR-VOLUME <drive:> -SCAN" locally or remotely via PowerShell.)"/>
<map value="0x2" message="$(string.map_VolumeCorruptionActionStateneeds to be taken offline for a short time to perform a Spot Fix. Please run "CHKDSK /SPOTFIX" locally via the command line, or run "REPAIR-VOLUME <drive:>" locally or remotely via PowerShell.)"/>
<map value="0x3" message="$(string.map_VolumeCorruptionActionStateneeds to be taken offline to perform a Full Chkdsk. Please run "CHKDSK /F" locally via the command line, or run "REPAIR-VOLUME <drive:>" locally or remotely via PowerShell.)"/>
</valueMap>
Localization resources section:
<string id="map_VolumeCorruptionActionStaterequires an Online Scan. An Online Scan will automatically run as part of the next scheduled maintenance task. Alternatively you may run "CHKDSK /SCAN" locally via the command line, or run "REPAIR-VOLUME <drive:> -SCAN" locally or remotely via PowerShell." value="requires an Online Scan. An Online Scan will automatically run as part of the next scheduled maintenance task. Alternatively you may run "CHKDSK /SCAN" locally via the command line, or run "REPAIR-VOLUME <drive:> -SCAN" locally or remotely via PowerShell."/>
<string id="map_VolumeCorruptionActionStateneeds to be taken offline for a short time to perform a Spot Fix. Please run "CHKDSK /SPOTFIX" locally via the command line, or run "REPAIR-VOLUME <drive:>" locally or remotely via PowerShell." value="needs to be taken offline for a short time to perform a Spot Fix. Please run "CHKDSK /SPOTFIX" locally via the command line, or run "REPAIR-VOLUME <drive:>" locally or remotely via PowerShell."/>
<string id="map_VolumeCorruptionActionStateneeds to be taken offline to perform a Full Chkdsk. Please run "CHKDSK /F" locally via the command line, or run "REPAIR-VOLUME <drive:>" locally or remotely via PowerShell." value="needs to be taken offline to perform a Full Chkdsk. Please run "CHKDSK /F" locally via the command line, or run "REPAIR-VOLUME <drive:>" locally or remotely via PowerShell."/>
It it the following lines of code in RegisteredTraceEventParser (lines 355-357 in release 2.0.34) that cause the problem:
string valueName = new string((char*)(&enumBuffer[mapEntries[k].NameOffset])).Trim();
enumWriter.WriteLine(" <map value=\"0x{0:x}\" message=\"$(string.map_{1}{2})\"/>", value, enumName, valueName);
enumLocalizations.WriteLine(" <string id=\"map_{0}{1}\" value=\"{2}\"/>", enumName, valueName, valueName);
I guess one solution is to HTML-encode valueName. Alternatively, maybe rewrite XML generation to use System.XmlWriter.
Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label.
this still repros with latest 3.1.19