dotnet/winforms

WinFormsDesigner does not copy PDB files into cache folder

svg2003 opened this issue · 4 comments

Environment

msvs 17.11.6

.NET version

net8

Did this work in a previous version of Visual Studio and/or previous .NET release?

no

Issue description

When designer copies references into cache folder, it does not copy pdb files. As the result, in case of exception in custom designer related code, there is no debug information (like line, where exception happens).
I know the option when I can embed PDB into DLL, but this is sometimes not the option, say, when DLL is modified by obfuscator (and change PDB as well), or PDB in modified to reroute source into external source server.

Steps to reproduce

check cache folder and there is no PDB files for copied dlls

Diagnostics


Get the below results:
Image

Yes, I know how to embed PDB. But sometimes it's impossible. Sometimes DLL is obfuscated during the build, so PDB itself must be changed at that time. Sometimes PDB is changed due to different reasons. Sometimes we don't have control to a project, etc, etc.

This is by design. Designer doesn't copy PDB files to shadow cache due to performance reasons as PDB files can be huge in size and it slows down designer load and reload considerably.
However, we do capture exception information in VS output window logs (VS -> View -> Output). If for any reason you don't see the exception information in the logs, then we can update the designer to log it.

I'm sorry, but it does not sound right. PDBs have the similar size, like DLLs, and not much more than the same debug information, embedded into DLLs. And if PDB is not used, it does not affect assembly loading at all.
Frankly, with modern hard drives, binaries copy is almost instant, comparing with whole DesignServer initialization time.

As of exception in log, again, information from PDB is pretty important. Say, you won't be able to see line number, when exception happens. So I'm wondering how you can print it in VS output window without PDBs.