It is possible to use either DotPeek or Resharper to debug Sitecore assemblies. The process is very similar and I will describe both solutions in this post. DotPeek and ReSharper can generate the PDB and the source files for the requested assemblies and returns them back to the debugger.
For the next steps make sure you have installed the latest DotPeek Version https://www.jetbrains.com/decompiler/download.
First, we need to start the DotPeek symbol server by clicking on the corresponding icon in the top menu.
DotPeek provides multiple options for providing symbols, choose the option which fits the best for your case.
I prefer the Assemblies opened in the Assembly Explorer option because you have the full control of the symbol server. You can change this setting later via your DotPeek settings.
When you choose your option the symbol server starts automatically, in the lower right corner you can see the detail information on hover above the symbol icon.
Copy the symbol server URL by right clicking on the symbol server icon. We need this URL for configuring the symbol location in Visual Studio.
Now we are able to use the symbol server, open Visual Studio and go to Tools>Options>Debugging>Symbols. With a click on the folder icon, we are able to add additional locations.
One last step in Visual Studio is required until we can use the symbol server, Sitecore prevents the debugging of external code, we have to disable this option.
Open Visual Studio and navigate to Tools>Options>Debugging>General, uncheck the checkbox Enable Just My Code.
Generate the Sitecore PDB
In the last step, we enabled the DotPeek symbol server and configured Visual Studio for a proper usage. Now we need to generate the PDB for our Sitecore assemblies. Drag & Drop your dependencies in the Assembly Explorer and start the generation process.
This process can take a few minutes, depends on the number of assemblies
The ReSharper way is very similar to the DotPeek solution, all Windows are the same and you are familiar with it when you tried the DotPeek Solution before.
Debug Sitecore assemblies with ReSharper is a way faster (fewer steps) than with DotPeek.
Also with ReSharper, we need to generate our PDB Files, navigate to ReSharper>Windows>Assembly Explorer place your Sitecore assembly via the open icon.
To start the generation process you need to use the same steps as in the DotPeek solution, have fun and debug your Sitecore assemblies.
Easy way to debug Sitecore Pipelines
First, we need to enable the option to navigation to third party resources, otherwise, we can't use the Search Everywhere function of ReSharper Crtl + T
Open Visual Studio and navigate to ReSharper>Options>Tools>External Sources, and set the option to Navigation to Sources.
Now we are able to search through the Sitecore assemblies and have the possibility to set breakpoints and debug the Sitecore assemblies.