3
votes

I'm trying to debug a web part manually deployed in my local sharepoint but I can't.

I did the following:

  • Set <compilation batch="false" debug="true" optimizeCompilations="true"> in web.config
  • Set breakpoints (e.g.: at the Page_Load method).
  • Deploy the project containing the webpart to my local sharepoint.
  • Copy the .pdb file manually to the c:/inetpub/wwwroot/wss/VirtualDirectories/80/bin folder.
  • Attach visual studio to all w3wp.exe instances running (there are three).

But Visual Studio reports "The breakpoint will not currently be hit. No symbols have been loaded for this document" so when I web browse to a page containing the web part, visual studio does not hit breakpoints.

6

6 Answers

5
votes

SOLVED: I was selecting Attach to: Automatically determine the type of code to debug, and Visual Studio automatically selected Native code. I changed the option to Debug these code types: Managed (...) and worked.

2
votes

what version of the ide are you using? you should be able to hit f5 to debug using vs2010. are you sure your debugger is connected to the correct w3wp process? are you manually deploying the web part? if so, it's possible the assembly has been cached and you need to recycle the app pool.

1
votes

A common cause of this problem is installing SharePoint on a machine that is already running Visual Studio. If you get this message: "The breakpoint will not currently be hit. No symbols have been loaded for this document", the easiest thing to do is reinstall Visual Studio on the machine. Then it works fine.

0
votes

I worked around this by using the Attach All hotkey (Alt A, S) via CKSDev: http://cksdev.codeplex.com/

I also can't see the web part in the edit page screen during an F5 session even though it is supposed to work: http://blogs.msdn.com/b/bethmassi/archive/2010/01/28/creating-a-sharepoint-visual-web-part-using-visual-studio-2010.aspx

I figured the issue is related.

0
votes

My favorite technique: Don't debug SharePoint Web Parts! Build a Windows Console App and do your debugging there instead.

1) Create a windows console app
2) Copy all the relative code from the web part
3) Replace any ASP.NET control output with Console output
4) Debug and step through
5) Copy the fixed code back to the web part.

Cheers!

0
votes
  • check that you do not have multiple web front end servers in your Development Farm , and if you have remove them and only leave the actual server running VS