Custom Controls Design Time Support Part 15: Debugging Design Time

This is final part of my series/tutorial on design time support, it was really fun writing it and hearing your comments and suggestions, I really learnt alot and hope you too had some experience in writing design time support for the custom controls.

In this part, I will show you how to debug the design time code we are writing (works with vs 2005 and 2008).

[more]

Prerequisites:

  1. Have a solution containing the control.
  2. Configuration set to Debug.

Steps:

  1. Open that solution containing the control.
  2. Right click the project and select Properties.
  3. Select Debug Tab as in Figure.
  4. From Select Action Group select Start external program then browse the devenv.exe usually found in this path C:Program FilesMicrosoft Visual Studio 9.0Common7IDEdevenv.exeDebug Tab
  5. Save Settings.
  6. Place breakpoints where ever design time code should be called.
  7. Now Debug the project a new instance of Visual studio will open.
  8. Start a new project to be a container of the project (new web application to test a web control or a windows application for a windows control).
  9. Choose from the toolbox the control you already built ( Right click toolbox > Choose Items > browse for the dll of the control.)
  10. Now drag your control to the testing container and make any design time action (as using smart tag methods), the first instance will stop in breakpoints. Congratulations you are debugging design time code now.

That's the end of the series, but not the end of design time tips and tricks any one comes in my mind, I will be sure to include it in this blog under the category of Design Time Support.

Hope someone out there will benefit from this tutorial, please let me know if you need any help concerning this issue.

8 thoughts on “Custom Controls Design Time Support Part 15: Debugging Design Time”

  1. Hello Amr,

    Nice set of articles…. I would like to know how the Control Properties are mapped to an HTML attribute in case of Web controls and how i can add my own properties to HTML tags and map them on Designer properties window rather than to ASP.Net custom controls.

    Thanks again for gr8 series.

    Cheers
    DJ

  2. Hi
    Thanks for this good articles. I want to build a custom controldesigner for my component (named oztBN) that derived from the bindingnavigator class. But the toolstripmenuitems (for example mymovefirstbutton) that I created does not be serialized in the form’s designer code. So when I close the form and open it again bindingnavigator.items collection is cleared. My code is in a Method of myBindingNavigatorActionList class.

    //this will use in DesignerActionMethodItem("CreateStandartButtons",….
    public void CreateStandartButtons()
    {
    ToolStripButton abc = new ToolStripButton("mymovefirstbutton");
    this.oztBN.Items.Add(abc);
    }

    I need your help urgently. thanks! Microsoft can do so I can do it :)

  3. hi, Amr! these are Gr8 articles. i loved to read them. i kept opening MSDN side by side where i thought i were not getting your points. anyhow its been one whole day since im constantly reading your stuff. this series is gr8 for component designers. anyhow many questions are still in my mind but you have solved all the problems i was having in my own component.

    Thanks
    Asif Ashraf
    MCAD.NET, MCP

  4. This method doesn’t seem to work with debugging custom TypeConverters. I read all over the Internet for various solutions… nothing’s working for me. I have Visual Studio 2005 SP1, tried Tools > Options > Debugging > "Enable Just My Code" (on and off), deleted .pdb files, set revision to "*" to ensure I’m not using a cached copy of the DLL, tried with Windows Forms and Console test applications, and various other permutations of building, debugging, etc. Still the symbols refuse to load. Any suggestions as to how I might debug a custom TypeConverter?

  5. Your articles are, well… glorious to say the least. Thanks so much.

    Do you have any idea why I can’t seem to debug my custom TypeConverter in a new instance of Visual Studio? I’ve looked all over the Internet for a solution. I have VS 2005 SP1, tried Tools > Options > Debugging > General > Enable Just My Code (Managed only) (on and off), deleted and recompiled DLLs and pdb’s in obj and debug folders, used "*" for DLL revision (to ensure that a cached copy is not being used), compiled and debugged using various console and windows forms test applications, tried on XP 32-bit box (I’m using 64-bit Vista), tried the System.Diagnostics.Debugger.Break() method (which, by the way, works great for debugging custom installers), and various permutations of inheriting from TypeConverter/ExpandableObjectConverter, overriding few/many methods, implementing converter interfaces, etc.

    Still the symbols for debugging refuse to load… and yes, am running in DEBUG mode with the DEBUG compilation symbols checked.

    Any help would be greatly appreciated.

  6. I need some help
    I developed a custom control that has a verb that shows a form. The form needs other dlls to run. If I follow the steps you describe here everythinf is working, but if I just use the control in the designer without the debugger it shows me an error saying that
    Visual Studio cannot find the dlls that support the form when I try to use the verb.
    Can you tell me the reason
    Thanks

Leave a Reply

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