Friday, December 12, 2008

Cant hit breakpoints in sharepoint debugging?

You are trying to debug some sharepoint code and when attaching the debugger you cant get the breakpoints to hit? Most important, recheck everything you have done...if in gac the path is c:\windows\assembly\gac_msil\assmblyname\version__pubkeytoken\

1.0.0.0 is not 1.0.0.0.0 ...this can make you loose some time...right? ;)

still, here are some sort of checklist and some last resort tactics, 'taken' from this post.

  • Did the solution really compile? I see sometimes developers causing a large amount of warnings causing not to see if there were any errors present. Then they copy the old assemblies to the bin folder or install them to the GAC causing this problem.
  • Are you connecting to the right w3wp.exe process? Is it not a non-closed browser instance?
  • Use IISRESET or better Recycle the Application Pool of your Web Application
  • Check if the compiled assemblies are the same one placed in the bin folder or the GAC. Even if there is nothing changed between compiled versions of assemblies it could cause problems with debugging.
  • It could be that the instance of the browser is using a cached assembly version. As you know when starting ASP.NET applications it caches the runtime versions of the assemblies. Clear the .NET Framework temporarily internet folder and subfolders. This folder is:
    "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files". If you are not able to clear this make sure that you did an IISRESET, closed all browser instances and closed Visual Studio.
  • If you are developing by putting the assembly into the bin folder, make sure that the instance of the browser is not using a GAC deployed version of the solution. I have seen this happening with collegaes which by accident used the wrong batch file for deployment on their development machine. The GAC version was accessed instead of the assembly in the bin folder.
  • Finally if you are working in a VPC or VMWare environment it could be that by using the debugger too often the whole environment is messed up. In that case do a restart of the environment and walk through the all the above points again

More on debugging here, and this very masoquist guy even goes to assembly level on sharepoint debugging(?!?!?!?)...i read it diagonally but theres asm on the post :-O