-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support .NET Source Context #725
Comments
As posted in the dotnet issue, here's an example app with a PDB that should contain sources: https://github.com/getsentry/sentry-dotnet/files/10124988/console-sample-pdb-with-sources.zip |
I have good experience with |
FYI: I've started looking into Alternative 2, i.e. support |
👍🏻 I believe Alternative 2 is a good quick solution. Eventually if we want to invest more effort into this, we can also take on alternative 1 later on. |
Problem Statement
.NET Developers want to see source context in their Sentry Issues, just like with any other language ecosystem.
CC @vaind @bruno-garcia
We have two ways to achieve this.
Alternative 1: Using Portable PDB Embedded Sources
Portable PDBs have support for embedded sources, they are defined here:
https://github.com/dotnet/runtime/blob/main/docs/design/specs/PortablePdb-Metadata.md#embedded-source-c-and-vb-compilers
A .NET compiler will do so if instructed by using
<EmbedAllSources>true</EmbedAllSources>
in the build definition.With this mechanism, we would need to extend our Portable PDB reader support, and cache in the following way:
Extending the Portable PDB Cache format for sources would need a new format version and backwards compatiblity to the version without sources.
Alternative 2: Using existing SourceBundles
In this approach, we would use sentry-cli to generate the existing
sourcebundle
format, and upload that as a separate file to Sentry.For this, we would need the following:
Discussion
Approach 2 would be the simpler solution implementation-wise, as it would just need one additional change, iterating over the files referenced by the Portable PDB. It also does not require developers to embed sources into the Portable PDB in the first place.
However, profiling and benchmarks have shown that our SourceBundle format is not the most efficient. Zip handling and parsing the JSON manifest (for every usage of the file) shows up in profiles as an expensive operation.
Appoach 1 would need more implementation effort, but would have the following benefits:
.pdb
file, and don’t need to have the original sources on the local file system to create a SourceBundle.Followup: Fixing SourceBundle
The inefficiency of the SourceBundle format comes from two downsides: usage of not-state-of-the-art zip/deflate, and usage of JSON manifests. We can fix both:
The current SourceBundle format has the advantage of being "almost" a valid zip file, and it can be extracted by tools like
unzip
, though some other tools will reject it. This is a valueable property as it allows folks to inspect the contents easily without need for more sophisticated tools.The text was updated successfully, but these errors were encountered: