-
Notifications
You must be signed in to change notification settings - Fork 753
Description
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
- Load a PDB that contains SourceLink information with wildcard path mappings
- Call SymbolReader.SourceLocationForRva() for an RVA that maps to a source file
- 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:
- Matching the source path against the wildcard pattern (e.g., c:\src\myproject*)
- 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:
- Handle wildcard patterns in the document keys
- Perform pattern matching against the requested source path
- Construct the final URL by substituting the matched path suffix
References