Skip to content

PerfView does not escape double quotes while saving view as XML #927

Open
@abhipsaMisra

Description

@abhipsaMisra

While saving the generated events as XML, PerfView does not seem to escape double quotes present in error messages/ log text etc. This results in an incorrect XML file being generated; which cannot be parsed by an XML parser successfully.

Event Dump:

<Event MSec="783264.8029" PID="3164" PName="Process(3164)" TID="5352" EventName="Enter"
  TimeStamp="05/02/19 14:48:17.279419" ID="1" Version="0" Keywords="0x0000F00000000004" TimeStampQPC="28,206,286,346" QPCTime="0.100us"
  Level="Informational" ProviderName="Microsoft-Azure-Devices-Device-Client" ProviderGuid="ddbee999-a79e-5050-ea3c-6d1a8a7bafdd" ClassicProvider="False" ProcessorNumber="1"
  Opcode="0" Task="65533" Channel="0" PointerSize="4"
  CPU="1" EventIndex="176871" TemplateType="DynamicTraceEventData">
  <PrettyPrint>
    <Event MSec="783264.8029" PID="3164" PName="Process(3164)" TID="5352" EventName="Enter" ProviderName="Microsoft-Azure-Devices-Device-Client" thisOrContextObject="RetryDelegatingHandler#16665527" memberName="SendTwinPatchAsync" parameters="({
      &quot;5d1a7e83-8418-4958-9a55-c4fc7d892d5b&quot;: &quot;e0aab212-e6a8-46b1-b015-8a492b1101b6&quot;
    }, CancellationToken#61476030)"/>
  </PrettyPrint>
  <Payload Length="336">
       0:  52  0 65  0 74  0 72  0 | 79  0 44  0 65  0 6c  0   R.e.t.r. y.D.e.l.
      10:  65  0 67  0 61  0 74  0 | 69  0 6e  0 67  0 48  0   e.g.a.t. i.n.g.H.
      20:  61  0 6e  0 64  0 6c  0 | 65  0 72  0 23  0 31  0   a.n.d.l. e.r.#.1.
      30:  36  0 36  0 36  0 35  0 | 35  0 32  0 37  0  0  0   6.6.6.5. 5.2.7...
      40:  53  0 65  0 6e  0 64  0 | 54  0 77  0 69  0 6e  0   S.e.n.d. T.w.i.n.
      50:  50  0 61  0 74  0 63  0 | 68  0 41  0 73  0 79  0   P.a.t.c. h.A.s.y.
      60:  6e  0 63  0  0  0 28  0 | 7b  0  d  0  a  0 20  0   n.c...(. {..... .
      70:  20  0 22  0 35  0 64  0 | 31  0 61  0 37  0 65  0    .&quot;.5.d. 1.a.7.e.
      80:  38  0 33  0 2d  0 38  0 | 34  0 31  0 38  0 2d  0   8.3.-.8. 4.1.8.-.
      90:  34  0 39  0 35  0 38  0 | 2d  0 39  0 61  0 35  0   4.9.5.8. -.9.a.5.
      a0:  35  0 2d  0 63  0 34  0 | 66  0 63  0 37  0 64  0   5.-.c.4. f.c.7.d.
      b0:  38  0 39  0 32  0 64  0 | 35  0 62  0 22  0 3a  0   8.9.2.d. 5.b.&quot;.:.
      c0:  20  0 22  0 65  0 30  0 | 61  0 61  0 62  0 32  0    .&quot;.e.0. a.a.b.2.
      d0:  31  0 32  0 2d  0 65  0 | 36  0 61  0 38  0 2d  0   1.2.-.e. 6.a.8.-.
      e0:  34  0 36  0 62  0 31  0 | 2d  0 62  0 30  0 31  0   4.6.b.1. -.b.0.1.
      f0:  35  0 2d  0 38  0 61  0 | 34  0 39  0 32  0 62  0   5.-.8.a. 4.9.2.b.
     100:  31  0 31  0 30  0 31  0 | 62  0 36  0 22  0  d  0   1.1.0.1. b.6.&quot;...
     110:   a  0 7d  0 2c  0 20  0 | 43  0 61  0 6e  0 63  0   ..}.,. . C.a.n.c.
     120:  65  0 6c  0 6c  0 61  0 | 74  0 69  0 6f  0 6e  0   e.l.l.a. t.i.o.n.
     130:  54  0 6f  0 6b  0 65  0 | 6e  0 23  0 36  0 31  0   T.o.k.e. n.#.6.1.
     140:  34  0 37  0 36  0 30  0 | 33  0 30  0 29  0  0  0   4.7.6.0. 3.0.)...
  </Payload>
</Event>

Generated XML snippet:

<Event EventName="Microsoft-Azure-Devices-Device-Client/Enter" TimeMsec="783264.803" ProcessName="Process(3164) (3164)" ThreadID="5,352" ProcessorNumber="1" thisOrContextObject="RetryDelegatingHandler#16665527" memberName="SendTwinPatchAsync" parameters="({ "5d1a7e83-8418-4958-9a55-c4fc7d892d5b":"e0aab212-e6a8-46b1-b015-8a492b1101b6" }, CancellationToken#61476030)" />

Activity

github-actions

github-actions commented on May 3, 2025

@github-actions

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.

github-actions

github-actions commented on Jun 2, 2025

@github-actions

This issue will now be closed since it has been labeled 'stale' without activity for 30 days.

brianrob

brianrob commented on Jun 2, 2025

@brianrob
Member

This looks like it's probably an easy fix that copilot can pick-up.

The code that generates this XML is in TraceEvent.Dump.

removed
StaleIssues that haven't been touched in 1 year.
on Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @brianrob@abhipsaMisra

    Issue actions

      PerfView does not escape double quotes while saving view as XML · Issue #927 · microsoft/perfview