Repository navigation
Conversation
Resolve .cs, .fs and .vb files for .NET profiles. Build-time PDB paths are mapped with .pyroscope.yaml path prefixes (language: dotnet), with a repository-relative fallback. Filenames without a source extension are assembly names and are reported as not found without fetching anything. Part of grafana#6058. Signed-off-by: Ankit Jha <jhaankit373@gmail.com>
ankit373
requested review from
a team,
bryanhuhta and
marcsanmi
as code owners
November 11, 2026 19:24
Contributor
|
Thanks for your contribution @ankit373. I don't feel comfortable merging this until we're able to test end-to-end with the .NET SDK. I'm not confident in some of the logic: I would imagine we would say backslashes (not forward slashes) in the paths, for example. |
A pdb built on Windows stores paths like C:\build\shop\Program.cs, and a deterministic build roots them at /_/. Turn backslashes into forward slashes before mapping lookup, and strip /_/ in the relative fallback. Tests use paths captured from pyroscope-dotnet with debug info on. Signed-off-by: Ankit Jha <jhaankit373@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
part of #6058
this adds a source finder for .net. real file paths only show up once grafana/pyroscope-dotnet#484 lands, so this is the pyroscope side, ready for when it does.
what changed:
language: dotnetvalue for.pyroscope.yamlmappings.find_dotnet.go. it handles.cs,.fsand.vbfiles. it strips the matched path prefix from the build-time pdb path (for example/src/src/Web/Controllers/OrderController.cswith prefix/src/src) and fetches the rest from the mapped source. if no mapping matches, it tries the path relative to the repo, same as javascript.MyApp.Web) as the filename. a filename without a .net source extension means there is no source, so the finder returns not found and does not fetch anything.find.gosendslanguage: dotnetmappings and.cs/.fs/.vbfiles to the new finder.C:\build\shop\Program.cs) are turned into forward slashes before mapping lookup, so write windows prefixes asC:/build/shop./_/(the repo root). the relative fallback strips it.dotnetadded to the list oflanguagevalues.lines: the profiler only sends
Function.start_line,Line.linestays 0. the finder only returns file content, so nothing here depends on line numbers. opening atstart_lineis up to the view.example mapping:
testing
CGO_ENABLED=0 go test ./pkg/frontend/vcs/...passes.find_test.go: pdb path with a prefix mapping for.cs,.fsand.vb, relative path, assembly name with a mapping, and an absolute path with no mapping.find_dotnet_test.gochecks that assembly names never call the vcs client.sdk-pdb-pathandpathmap-rootuse paths captured from pyroscope-dotnet with debug info on.windows-pdb-path,pathmap-rootandpathmap-root-windowsfail without the fix.dotnetis not a valid language there.golangci-lint run(v2.2.2, as in the makefile) onpkg/frontend/vcs/...: 0 issues.