Skip to content
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 full Windows PDB format for .NET #871

Open
bruno-garcia opened this issue Oct 7, 2024 · 4 comments
Open

Support full Windows PDB format for .NET #871

bruno-garcia opened this issue Oct 7, 2024 · 4 comments

Comments

@bruno-garcia
Copy link
Member

From: https://github.com/getsentry/team-ingest/issues/490

We have symbolication for the .NET Portable PDB format, and for the Windows PDB format with native code, but not for the Windows PDB format as used by .NET.

It would be useful to support this, so that we can symbolicate .NET Windows apps and libraries that are compiled using this debug format when symbols are not available client-side.

See https://learn.microsoft.com/dotnet/csharp/language-reference/compiler-options/code-generation#debugtype

Debug types full or pdbonly when compiled on Windows will generate a Windows PDB, not a Portable PDB. (The pdbonly option creates a variation which is more optimized for release builds, so both should be supported if possible.)

This applies both to .NET Framework and to .NET Core (and modern ".NET").

--

See attached zip containing two console app projects. One is .NET 6 and the other is .NET Framework 4.8.

FullPDBProjects.zip
file is lost, we'll find a replacement

In both projects, the Debug build was compiled with DebugType=full and the Release build was compiled with DebugType=pdbonly. (These are the default settings for .NET Framework out of the box.)

All .pdb files here are Windows format PDBs, not portable PDBs.

Also note that .NET 6 compiles a .dll containing the application code and a .exe "wrapper" program with the entrypoint. This is the new way since .NET Core 1.0. But .NET Framework compiles a single .exe containing all code and the entrypoint in a single file.

@bruno-garcia
Copy link
Member Author

@jamescrosswell could you help with a sample build on Windows? The attached sample was lost due to the repo being deleted.

We should be able to get those Windows PDBs by building a .NET Console app on a Windows machine. It should be generating Windows PDBs as opposed to on Mac and Linux where it uses Portable PDBs.

@bruno-garcia bruno-garcia added this to GDX Oct 7, 2024
loewenheim added a commit to getsentry/symbolicator that referenced this issue Nov 11, 2024
#1541)

This adds a new `CacheError`/`ObjectFileStatus`
variant for cases where a debug file is OK, but can't be used
for the purpose for which it was requested. Currently the only
such case is symbolicating .NET events with portable PDB files
(see getsentry/symbolic#871).

In addition, this also makes Symbolicator request both
portable PDB and Windows PDB files for symbolicating .NET
events. The reason for this is that although Windows PDB files
can never be used for that purpose, at least this way we get a
concrete error status we can report to the user. If we don't do
that, we get cases like #1539.
loewenheim added a commit to getsentry/symbolicator that referenced this issue Nov 20, 2024
#1554)

This adds a new `CacheError`/`ObjectFileStatus`
variant for cases where a debug file is OK, but can't be used
for the purpose for which it was requested. Currently the only
such case is symbolicating .NET events with portable PDB files
(see getsentry/symbolic#871).

In addition, this also makes Symbolicator request both
portable PDB and Windows PDB files for symbolicating .NET
events. The reason for this is that although Windows PDB files
can never be used for that purpose, at least this way we get a
concrete error status we can report to the user. If we don't do
that, we get cases like #1539.
@jamescrosswell
Copy link

ConsoleApp.zip

Apologies for the delay... see zip attached. Includes the source as well as:

  • Windows PDB: pdb/full/ConsoleApp.pdb
  • Portable PDB: pdb/pdbonly/ConsoleApp.pdb

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 25, 2024
@loewenheim
Copy link
Contributor

Thank you very much!

@jjbayer
Copy link
Member

jjbayer commented Feb 4, 2025

@bruno-garcia I'm completely new to .NET, but reading the official documentation it seems like Windows PDB for .NET is deprecated:

Using Windows PDBs for managed code is obsolete and is only needed for legacy tools. It is recommended that you use portable PDBs instead of Windows PDBs, as some newer compiler features are implemented only for portable PDBs.

To use portable PDBs on tools that do not support them, you can use Pdb2Pdb, which converts between portable PDBs and Windows PDBs.

https://learn.microsoft.com/en-us/dotnet/core/diagnostics/symbols

Do we want to invest into Windows PDB for .NET nonetheless?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Status: No status
Development

No branches or pull requests

4 participants