sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Debugging not working with self-contained single file .NET6 assemblies

Open Pyrdacor opened this issue 2 years ago • 0 comments

Description

When I publish a .NET assembly with the following command, there are no debug symbols available in VS2022. And trying to load the PDB manually leads to "image mismatch" errors or "can't find matching debug symbols".

This is the publish command:

dotnet publish -c Debug ./path/to/project.csproj -p:PublishSingleFile=true -p:IncludeAllContentForSelfExtract=true -r win-x64 --nologo --self-contained -o ./path/to/output

However if I set self-contained to false, it just works: --self-contained=false.

The problem occurs regardless if the debug symbols are embedded or stored as a PDB file.

I hope this is the right place. I know VS2022 is the one which can't load the debug symbols but I am pretty sure it's about the debug symbol creation/connection and not the loading. But I might be wrong.

Others seem to have the same problems. Look here: https://stackoverflow.com/questions/64897623/no-symbols-when-attaching-to-net-core-program-single-file/73796666#73796666.

Configuration

  • dotnet 6 (but seems to be a problem since netcore already)
  • tested on Win7 x64 but I guess the OS doesn't matter here
  • x64 in this case
  • Debug config of course

Pyrdacor avatar Sep 21 '22 07:09 Pyrdacor