When using an external closed-source library, it can sometimes be useful to understand how it works. There are quite a few decompilers on the market: Reflector, DotPeek, JustDecompile, ILSpy. These allow you to decompile a .NET DLL or EXE to understand how they work. It's very convenient but sometimes we want to go further and see how this code behaves at runtime.
To display the source code of a DLL, Visual Studio relies on PDB files (Symbol files) to link compiled code to source code. Visual Studio can load these files either from the local disk or from a symbol server. The problem with third-party DLLs is that we have neither the source code nor the PDB files. This is where DotPeek comes in. It positions itself as a symbol server and decompiles the DLLs on the fly and generates a PDB. Visual Studio can thus display the source code.
Download and install DotPeek: https://www.jetbrains.com/decompiler
Start the symbol server
Configure Visual Studio to use this server (the full URL is available in the DotPeek Options window):
Now that DotPeek is set up, just use F11 excessively in Visual Studio
In case of problem you can check the following points:
Open the "Project / Pdb Generation Log" window in DotPeek. All symbol requests are displayed there. If the assembly is not listed, check the following point.
In Visual Studio, open the Debug / Windows / Module window and verify that the symbols are loaded for the desired assembly. If this is not the case, force the loading of these:
Do you have a question or a suggestion about this post? Contact me!