Skip to content

Cannot profile exception performance possibly due to stack walking issue #13218

Closed
@GSPP

Description

@GSPP

It appears impossible to profile the CPU usage of exceptions. There seems to be some issue with stack walking.

        while (true)
        {
            try
            {
                var reader = new Utf8JsonReader(new byte[] { (byte)'{' });
                while (reader.Read()) ;
            }
            catch
            {
            }
        }

Process Explorer shows a truncated stack with unusual 0x0000 entries:

image

PerfView loses track of where the time is spent:

image

Note, that 95% of the time is unaccounted for and it appears as if JSON code calls into Main.

DotTrace shows a lot of time spent in "Unsafe Stack Walking" but in the wrong place:

image

There might be some quicks in how the tools are functioning. But it seems that the basic stack walking data available to profilers is broken.

Environment:

  • In 3.0.100-preview7-012821
  • Windows 10
  • Latest Windows SDK for dbghelp.dll
  • Latest PerfView

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions