Skip to content

Excessive exceptions generated in StackTraceSymbols when using Portable PDB #98506

@wasabii

Description

@wasabii

I have discovered a situation when attempting to build and use a portable PDB file which is causing a performance degredation in my application by emitting unneccessary exceptions when collecting stack traces (for exceptions).

There is at least one situation where this code can be entered into with a handle of value 0x06000000. That is, technically, a nil token, but with an invalid row ID. In the case I have observed it is because a dynamic method is on the stack and that dynamic method is attached to an existing type from an assembly with an associated portable PDB.

Thus the check in StackTraceSymbols which checks if it's Kind == MethodDef succeeds. The code continues, converts it to a MethodDebugInformation token, and then attempts to look it up from the MetadataReader, which then calls Throw.OutOfBounds. Which causes another exception.

The problem seems to appear all the way back to .NET 6.

Metadata

Metadata

Assignees

Labels

area-Diagnostics-coreclrin-prThere is an active PR which will close this issue when it is mergedtenet-performancePerformance related issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions