Unable to debug webpart in Visual Studio 2010 (moss 2007)

Hey everyone

Today I had a problem that kept me busy for 2 hours.

I loaded up an old webpart (was in type class library and I’ve build the webpart entirely via code) and I wanted to debug it.

Deployed the webpart and activated the feature, checked the DLL was in the GAC (global assembly cache).

Visual Studio loaded up the solution, added a breakpoint in the constructor, attach to process. Ok the red dot was filled so all was good.

Ok let’s go debugging, eeuhm, that’s strange the webpart is being displayed and the breakpoint isn’t being hit.

After searching for 30min, I used my best friend (google 😉 )

Found a few possible solutions, saying that it’s a 32-64bit setting in IIS. Ok let’s change it (advanced setting in IIS web app ) , nope didn’t work

Another one was in Microsoft.netframeworkv4…… ASPNET_REGIIS -ir , nope didn’t work as well

Last one , basic setting in IIS , change to classic and V4 , still nothing.

Changed the 32-64bit, V4 back to normal and starting to look again.

To make a long story short. If you can attach to the process, it all appears normal but VS2010 doesn’t want to hit any breakpoints. Go to Tools -> attach to process -> select the W3WP and before you hit attach, check the “attach to” field.

If this is on Automatically, this could be your problem. Especially when it says “Automatic: Managed (v4.0) code, T-SQL code” .

Change it to manual and only select “Managed (v2.0, v1.1, v1.0) code”.

This did it for me 😀

happy debugging

Leave a Reply

Your email address will not be published. Required fields are marked *