A frequent problem that occurs to me while developing within SharePoint is the fact that my debugger refuses to catch events, often indicated by empty circles on the breakpoints pane. Usually the cause is always different, so I’ve started logging fixes and have a checklist for quick reference if this occurs.
The SharePoint Debugger Fix List:
- Verify VS project site URL. You ARE deploying to where you think you are, right?
- Check that you are not compiling in release mode
- Clean, rebuild, redeploy the solution
- Run IISReset command from Start -> Run
- Check post build log warnings
- Delete the pkg/obj/bin folders within your solution directory, rebuild/deploy
- Ensure your project is actually deploying. Check that add solution is part of your deploy from project properties.
*Note that there are likely a few other things that may cause this issue but this has often covered 99% of my issues. Be sure to check your debug build settings/symbols output for example. Was there a recent change you did to the project? Perhaps start looking there.
Feature receivers involving web templates are trickier to work with.
- Try using System.Diagnostics.Debugger.Launch(); in your code to force the debugger to prompt for access when the code is hit. This is VERY useful for feature receivers.
- Retract solution, remove orphaned features, then retry.
You must attach the debugger to owstimer.exe in order to debug such code. After deploying new code the timer service must be restarted (iisreset will not suffice)
net stop sptimerv4
net start sptimerv4
I often like to make sure that the code in the Global Assembly Cache is actually there, to do so I do the following:
- Run ilspy which lets you look at code inside DLL’s. From the menu you can grab a DLL from the global assembly cache. Make sure yours is there, if it is, open it up and check the code structure. See if your latest changes are in there, if not, your deployment is not completing correctly.
- If #1 reveals that code is not part of the GAC, check your solutions bin folder and drag and drop your DLL and check that code as well. It may help with understanding why the issue is occuring.