How Do I Debug the Design-Time Support Of My Server Controls?

Debugging your server controls isn't too difficult. If your control and your consuming Web project are in the same Visual Studio .NET solution, debugging the control is as easy as setting a breakpoint and running your application in Debug mode. Debugging the Design-Time support of your controls is a bit trickier.

Follow these steps to enable design-time debugging for your server controls:

  1. Open up the Property Pages dialog for your project with your server controls. Open the Configuration Properties node and then click Debugging.
  2. Under Start Action, set Debug Mode to Program and then click Apply. Due to a problem (a bug maybe?) the field for Start Application doesn't update correctly if you don't click Apply. Once you click the Apply button, the field Start Application shows a button with three ellipses at the end. Click that button and then browse to the program devenv.exe, located in your Visual Studio .NET folder (the default location is C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\)

    The Property Pages in Visual Studio .NET
    Figure 1: The Property Pages in Visual Studio .NET

  3. Click OK to dismiss the Property Pages dialog and to apply the settings.
  4. Set breakpoints in your code at the locations where you want the program to halt. Click in the margin of the code editor, or click F9 to set the breakpoints.
  5. Start the debugger for your component by pressing F5 or by choosing Debug | Start from the main menu.
  6. By starting the debugger, you actually start a new instance of Visual Studio .NET that you can attach to. In this new instance, open up an existing ASP.NET Web Application, or create a new one.
  7. Add your controls to the toolbox. To do this, right-click the toolbox, choose Add/Remote Items..., and browse to the DLL of your Web Control Library project.
  8. Finally, drag an instance of your control on an ASPX page. If you set a breakpoint in one of your constructors, the code will break immediately. Otherwise, you'll have to change your control (resize, change a property etc) to break into the code.

Where to Next?

Wonder where to go next? You can read existing comments below or you can post a comment yourself on this article.

Doc ID 306
Full URL https://imar.spaanjaars.com/306/how-do-i-debug-the-design-time-support-of-my-server-controls
Short cut https://imar.spaanjaars.com/306/
Written by Imar Spaanjaars
Date Posted 06/23/2004 18:28
Date Last Reviewed 06/06/2006 22:39
Listened to when writing Octopussy by Hed Planet Earth (Track 11 from the album: Blackout )

Talk Back! Comment on Imar.Spaanjaars.Com

I am interested in what you have to say about this article. Feel free to post any comments, remarks or questions you may have about this article. The Talk Back feature is not meant for technical questions that are not directly related to this article. So, a post like "Hey, can you tell me how I can upload files to a MySQL database in PHP?" is likely to be removed. Also spam and unrealistic job offers will be deleted immediately.

When you post a comment, you have to provide your name and the comment. Your e-mail address is optional and you only need to provide it if you want me to contact you. It will not be displayed along with your comment. I got sick and tired of the comment spam I was receiving, so I have protected this page with a simple calculation exercise. This means that if you want to leave a comment, you'll need to complete the calculation before you hit the Post Comment button.

If you want to object to a comment made by another visitor, be sure to contact me and I'll look into it ASAP. Don't forget to mention the page link, or the Doc ID of the document.

(Plain text only; no HTML or code that looks like HTML or XML. In other words, don't use < and >. Also no links allowed.