We help IT Professionals succeed at work.

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

Onthrax asked
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.
Watch Question

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.


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 :)


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! :)
Unlock this solution and get a sample of our free trial.
(No credit card required)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.