Although VS 2005 provides awesome support for developing Web parts one of the pain points can be debugging a web part, some tips on how to debug a web part :
Debugging can be difficult if the web part is published in GAC (IIS needs to access the pdb file for the web part assembly to load debug symbols) so while in development environment it is more useful to deploy the web part to the Bin directory and use manual Installation instead.
Enabling Debugging in the SharePoint Web.Config file
Note: Make sure these flags are unset when moving to the production server.
Set the CallStack attribute to true. This allows for the callstack and exception to be displayed.
<SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">
Change the Site's trust level to either Medium or Full (if the assembly is in GAC then the Trust level is automatically Full Trust), by default the trust level is WSS_Minimal
<trust level="WSS_Medium" originUrl="" />
Thats it !! .. The next time the web part is loaded the Sharepoint website will break into the code.
For more infrormation: http://msdn2.microsoft.com/en-us/library/ms916837.aspx#sharepoint_debugwebparts_topic4