Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug code in Sitecore

I would like to debug the Sitecore code just like asp.net code, but do not know how to.

The solution is outside wwwroot. Using Visual Studio 2013, IIS 10.0, Windows 10, Sitecore 8

Does attaching a process, is all I have to do to be able to debug.

In Visual Studio, when I click on Tools > Attach Process, there is no aspnet_wp.exe or w3wp.exe.

Is there any other process to follow.

like image 680
Qwerty Avatar asked Mar 24 '16 12:03

Qwerty


2 Answers

When you try Debug > Attach to Proces please make sure your site is running. Please also check if "Show Process from all users" is checked. See below picture:

enter image description here

like image 133
Vlad Iobagiu Avatar answered Sep 27 '22 22:09

Vlad Iobagiu


You can use dotpeek to debug the Sitecore Code.

Steps to debug Sitecore Code:

  1. Download and Install Dotpeek.
  2. Open dotPeek and click on StartSymbolServer default dotPeek uses port 33417.

  3. Open Visual Studio options

  4. In Debugging/Symbols tab click on add new symbol files location and enter http://localhost:33417 (or the port that you assigned in the previous step)

  5. In VS options go to Debugging/General and uncheck “Enable Just My Code” option if it is checked

  6. In dotPeek click on open icon that will show a dialog for loading an assembly

  7. After the assembly is loaded right click on it and click generate pdb. In the appeared window choose the namespaces that you need to debug (or each one as I did) and click Generate Now we are ready for debugging

  8. Open VS and attach to the sitecore process (loading symbols may take longer than usual)

More info: http://bilyukov.com/debugging-sitecore-dotpeek/

Note: You can also export the Sitecore dll to a VS Solution in dotpeek along with its pdb file, then follow the above steps to configure your VS. You need to attach to the Process of the exported Sitecore Solution.

like image 28
Hishaam Namooya Avatar answered Sep 27 '22 23:09

Hishaam Namooya