A student and I wrestled with a Server Control issue tonight. We couldn’t debug the server control, despite following the conventional wisdom of having 2 projects (one control project and one asp.net project), referencing the control project from the asp.net project and adding the control to a page, and launching the asp.net project as the “Start Up” project with breakpoints set in the control project.
I googled for “Debug Server Control” along with asp.net, c#, and vb.net and found very slim pickings — mostly irrelevant stuff, so this post is partially an attempt to fill the void . . .
We solved our problem by deleting the control project assembly and debugging file (.pdb file) from the bin directory of the asp.net project. We ran our asp.net project again (as “Start Up” project, again) and the referenced assembly was automagically added to the bin directory again. This time it worked. It works ok from now on.
Now, I know if you’re using an external assembly you change the control code you’ll have to make sure the assembly version is appropriate in the client applications, but this is the first I’ve seen of this when the projects were contained in the same Solution and the asp.net application was referencing the control project from within the solution. The fact our rebuild generated fresh versions of the assembly (and the .pdb file) indicates VS.Net is sophisticated enough to recognize the relationship between the two projects.
Anyway, by deleting the referenced assembly and rebuilding our project, it solved the problem.