Can’t step into/debug Sharepoint 2010 Referenced Projects or Assemblies
The Context
With Asp.Net, I like pushing out my core classes into a separate assembly. To me, the Asp.Net project itself is really just an enclosure, a host if you like. The same goes with WCF services.
So I tend to have projects like:
- Core for domain objects
- Web for Web specific classes: service layer, controllers/presenters, utility, helper, etc
- Web.Service.WebHost: a thin WCF wrapper for the service classes
- Web.UI: the Asp.Net website which contains only the UI logic
With Sharepoint 2010 I like to do a similar thing:
- Intranet.Core
- Intranet.Web
- CustomWebParts for Sharepoint 2010 feature which references both the other Projects.
Both dependent projects will be deployed to the GAC (or web application as appropriate).
The Problem
The problem is: we can no longer debug/step through the code from Visual Studio.
This is because the assemblies are treated as an external assembly that Sharepoint reference to.
The Fix
The fix is simple, we want to enable debugging to not just ’˜My Code' but also to include the ’˜external' assemblies.
On Visual Studio 2010, Go to Tools > Options > Debugging > General > untick Enable Just My Code (Managed only)
That is enough, but unfortunately, it will try and resolve all the .Net core assemblies too. Since it won't be able to find the PDBs, it'll try and fetch it from Microsoft symbol servers. Let's disable that, otherwise going to a debugging session will take a long time.
Debugging > Symbols > untick both pdb locations.
To make it even faster, let's specify only to debug into the specific assemblies by selecting Only specified modules and click on the link.
You will be able to enter wildcards, such as Intranet.*.dll
That's it. You can now debug into the referenced assemblies.
Tested with Sharepoint 2010, Visual Studio 2010
Thank you VERY MUCH. but why shouldn't it be enabled by default??
This is certainly pretty effective to spice up your firm or business approach.