How to handle exception "Error rendering control" at designMode in Visual Studio?

Posted on 2008-11-18
Last Modified: 2013-11-26
I have created a custom control which is doing exactly as it should, but for some reason is showing an exception in designmode.

Error rendering control - MyControl
An unhandled exception has occured.
TagPrefix:MyControl could not be set on property 'MyProperty'.

This grey block only appears in DesignMode when using the custom control. All works fine at run time.

The grey block appears when modifying a property of type "List Of" in the property window. But again it does not cripple anything at run time.

I would like to 'handle' this exception, but where is it being generated. I assumed it would be on the render sub of the control, but my attempts have failed. Any insight would be appreciated.
Question by:Onthrax
    LVL 14

    Expert Comment

    Do you do any overloading of constructors or anything like that?  It is tough without seeing the code as to why it might be complaining.  usually it is due to variables that need to be initialized or something like that.
    LVL 13

    Author Comment

    Yes as the control is inheriting a basevalidator I need to override/overload various subs.

    Posting code is a little tricky as it is weaved into a greater whole. I could try to create a new control and only put in the classes and such that cause the exception.

    This will take some time, so I will only do this if you really want to put some time into checking out the code.. Please let me know..

    Cheers :)
    LVL 13

    Author Comment

    I really need this resolved so I went ahead and ripped everything I could. This is the most basic as I can get it.

    I have uploaded the control here:

    If you create a new webpage and drag the control onto the page, you will see the [Custom validator] tag.
    You can change all properties without any problems except for the properties 'Failure' and 'Success'. If you click on the elypses and press the ADD button, the gray box will appear in visual studio. If you add a few and run the page, source will look like this:

        <cc1:ServerControl1 ID="ServerControl11" runat="server">
                <cc1:Effect Input1="asd" Input2="sdf" Input3="fds" />
                <cc1:Effect Input1="fds" Input2="sdf" Input3="sdf" />
                <cc1:Effect Input1="ss" Input2="dd" Input3="ff" />

    And the code will execute fine. The issue only presents itself in visual studio..

    Hope you can find the problem. Thanks in advance! :)
    LVL 13

    Accepted Solution

    I have finally figured it out. Cost me over 8 hours, but at least I got it fixed.

    Error was caused by the property of type 'List Of' not being readonly.

    In case you had already taken a look, thanks for trying. If not, thanks for your attempt.

    Cheers :)

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now