2

To debug a custom timer job in visual studio, I wasn't able to hit the debugger.

Is it necessary to add the .PDB file to GAC?

I tried doing the above, but it's not allowing to drag and drop this particular file.

Why do we need to add this file?

Arthur Castro
  • 610
  • 6
  • 18
Thomas Mathew
  • 1,151
  • 6
  • 15
  • 30
  • Note that you should attach to both w3wp.exe and OWSTIMER.exe process, because before timer job goes to 'sleep', w3wp.exe process executes it, afterwards - owstimer.exe? – Janis Veinbergs Sep 19 '11 at 14:20

2 Answers2

2

Drag and drop does not work in the assembly folder because of the shell windows explorer attaches to it. You can do 3 things to bypass this shell -

  1. Copy the .pdb file via cmd in C:\windows\assemblyGAC_MSIL\yourassembly\yourassemblyversion\

  2. Use gacutil.exe

  3. Map the assembly folder as Network-Drive \server\c$\windows\assembly and then copy the .pdb just as you normally would

Here is a good article about debugging timer jobs. It's written for SP2007 but should apply to SP2010 aswell.

int32
  • 1,687
  • 1
  • 10
  • 6
2

I always compile into bin, then move the DLL file only to the GAC (usually manually) and then attach the debugger to OWSTimer.exe process. Works just fine, just don't forget to restart the service after replacing the file in the GAC.

Vladi Gubler
  • 2,458
  • 1
  • 13
  • 15
  • Thanks for the info. But somehow,am not able to debug. The debugger circle is empty. Also the OWSTimer.exe process is shown as from a diff user. Does this process needs to be running from my account? – Thomas Mathew Sep 20 '11 at 04:27
  • 1
    No, it does not, in my case it also runs under a different account. Make sure you are trying to debug .NET 2.0 and not 4.0. The PDB file needs to remain in the bin. Also make sure you are compiling in debug mode – Vladi Gubler Sep 20 '11 at 10:13