Skip to content

SymbolReader fails to parse SourceLink mappings with wildcard patterns #2350

@ivberg

Description

@ivberg

Description

SymbolReader.SourceLocationForRva() fails to parse SourceLink JSON mappings that use wildcard patterns (e.g., "path\*": "url"). This prevents source file retrieval for PDBs that use this common SourceLink format.

Error Message

Error: Could not parse SourceLink Mapping:
"c:\src\myproject\*": "https://dev.azure.com/myorg/myproject/_apis/git/repositories/myrepo/items?path=%2f*&versionDescriptor.versionType=commit&versionDescriptor.version=abc123&download=true&api-version=2.0",
"external\sdk\inc\header.h": "https://example.com/blobs/ABC123?download=true&filename=header.h"

Reproduction Steps

  1. Load a PDB that contains SourceLink information with wildcard path mappings
  2. Call SymbolReader.SourceLocationForRva() for an RVA that maps to a source file
  3. Observe the parsing error in the log output

Expected Behavior

SourceLink JSON with wildcard patterns should be parsed correctly, allowing the source file URL to be constructed by:

  1. Matching the source path against the wildcard pattern (e.g., c:\src\myproject*)
  2. Substituting the matched portion into the URL template

Actual Behavior

The parser fails with "Could not parse SourceLink Mapping" and source file retrieval fails.

SourceLink JSON Format

The SourceLink format supports two types of mappings:

{
"documents": {
"c:\src\myproject\": "https://raw.githubusercontent.com/org/repo/commit/",
"c:\external\file.h": "https://example.com/direct-link-to-file.h"
}
}

The wildcard * in the key matches any path suffix, and the * in the URL is replaced with the matched portion.

Environment

  • Microsoft.Diagnostics.Tracing.TraceEvent: 3.1.x
  • .NET: 8.0
  • OS: Windows 11

Impact

This affects source file viewing for any PDB built with standard MSBuild SourceLink tooling, which commonly produces wildcard mappings. Many Microsoft and third-party PDBs use this format.

Suggested Fix

The SourceLink parsing logic in SymbolReader should:

  1. Handle wildcard patterns in the document keys
  2. Perform pattern matching against the requested source path
  3. Construct the final URL by substituting the matched path suffix

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions