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

Absolute symbols path in PEHeaders #967

Open
simonferquel opened this issue Mar 12, 2025 · 0 comments
Open

Absolute symbols path in PEHeaders #967

simonferquel opened this issue Mar 12, 2025 · 0 comments

Comments

@simonferquel
Copy link
Contributor

Consider the following code:

assemblyDefinition.Write(outputAssemblyPath, new WriterParameters
{
  WriteSymbols = true,
  SymbolWriterProvider = new PortablePdbWriterProvider(),
}

If outputAssemblyPath is an absolute path, the symbol path written in the dll PE Headers will be absolute as well.
This can lead to confusion of the debugger if somehow the assembly is loaded from a different path.
Also, if the assembly is loaded with AssemblyLoadContext.LoadFromStream to prevent the runtime to lock the assembly file, an attached debugger will likely lock the pdb file as it will still be able to find it (as the PE Header has the full path information) - while the expected behavior would have been for the debugger to pick the symbols information from the symbols stream passed to the AssemblyLoadContext.

In Unity CoreCLR editor context we worked around that by writing the assembly to a custom stream, but it would be nicer if the PE header would be filled with a path relative to the assembly output directory - the same way csc seems to behave.

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

No branches or pull requests

1 participant