Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
Markdown Monster - The Markdown Editor for Windows

Error Creating Control Errors in the ASP.NET Designer


:P
On this page:

I’ve been getting a lot of Error Creating Control in the designer recently. Well, probably recently only because I’ve been using the designer a bit over the last couple of days to build some data entry heavy pages that use my DataBinder control, which is a lot easier to set up using the designer than in markup since it’s an extender control.

But more than a few times in the last few days Visual Studio had decided to mangle my control with an error like this:

ErrorControl

It looks like somehow Visual Studio is failing to properly sync the files in the BIN directory (which are not actually used in the designer) and the temporary copy of the assemblies that simulates the ASP.NET temporary assembly directory. How these files can get out of sync or how they even can be differentiated is something I don’t understand.

I’ve been trying to pinpoint what causes the problem and it seems (although I can’t duplicate it 100%) that when the underlying control assembly changes these errors start popping up in the designer. In this particular project I am using controls in my own Web Control project and since I’m working on the library at the moment this control assembly gets recompiled occasionally. Every time a change is made it seems like Visual Studio screws this up.

The resolution? Restart Visual Studio which cleans out the temporary assembly folder. When I come back in and re-open the page everything is as it should be.

It seems this behavior is something new though – I’ve done heavy control development and never really noticed issues with this until Visual Studio 2008 released possibly even as late as SP1. In the past I’ve always been able to use the designer’s Refresh option to get around new assemblies, but this no longer seems to work. The errors in the designer are so common that I am just not using the damn thing except for a few things like hooking up data binding to my custom binder and other extender controls which are just easier to deal with this way.

The VS designer just keeps getting worse with each version and even each cumulative update it seems. Yeah sure there are new features that are really nice too, but when stability suffers I couldn’t give a rat’s ass for new features when the designer becomes unusable. I just want the thing to work :-} and not start me into trouble shooting or restart mode every 20 minutes. I really hope Microsoft is going to spend some time on quality control on the designer for VS 2010.

Heck even better give me a way to use the property sheet COMPLETELY without the designer first having to be activated. Specifically I’d like to be able to set extender control properties without having to switch into the designer. It would be killer if more focus could go into bringing the markup editor on par in terms of support functionality that the designer supports (like extenders, many of the localization features, even things like event hookups etc.).

Ah yeah, one can dream…

Posted in ASP.NET  

The Voices of Reason


 

Josh
February 16, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

Rick,

Having run into similar difficulties recently myself I can only sympathize! A suggesstion: clear out the %windows%\Microsoft .NET\Framework\2.xxx\Temporary ASP.NET files folder - that can get gummed up pretty easily, and it's safe to delete all the files there. It could help your problem.

Hope it helps!

Josh

Mohammad Azam
February 16, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

Hi Rick,

I hear ya man! Actually I was having the same issues about a week ago when I was trying to develop a custom server control. The solution close VS and start again. I am wondering that if cleaning the temporary folder will resolve this problem.

Thanks,
Azam

TD
February 16, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

Looks like MS has a hot fix in the works
http://code.msdn.microsoft.com/KB961864

Egil
February 16, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

Hi Rick,

Don't even have to read your entire rant to recognize the issue, I have had this problem for a while with VS 08 SP1. Even posted a question about it on stack overflow (http://stackoverflow.com/questions/328763/how-to-take-control-of-style-sheets-in-asp-net-themes-with-the-styleplaceholder-a)... Hope the hotfix TD links to solves the problem.

Rick Strahl
February 16, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

@Josh - the ASP.NET temporary folder is not used by Visual Studio's designer AFAIK. It's only used for IIS or Cassini.

@Mohammad - unfortuntately the folders can't be cleared because they are in use (makes sense the DLLs are loading from there), so a shut down is the only thing that seems to help with this.

@TD - yes the cannot set property bug is something I reported on Connect a long time ago, which can occur in many situations including on the native ASP.NET controls. This however appears to be a different issue altogether.

Mitchco
February 16, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

Dude, you use the designer? When I first got into web development, I moved from VB 6 Forms to Visual InterDev 97 and classic ASP. I naively thought, cool, the "forms" designer in Visual InterDev would be the same as it was in VB6, but for web pages. Oh, the pain! And the pain has not stopped since...

You would think that one of the top most wanted features in Visual Studio would be a "real" web forms designer, the same as the WinForms designer. You know, a real WYSIWYG designer. As you say, one can only dream.

Mohammad Azam
February 17, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

@Mitchco,

When creating a custom server control you need to look at the design surface and make sure everything is working as expected.

Mitchco
February 18, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

@Mohammad,

My point is that the designer is basically useless. See what I mean here: http://softwareindustrialization.com/AProgrammersDilemmaProductivityLostPartII.aspx
Check out the design time versus the runtime views. And sadly the same result in VS2010 - at least on the PDC version I tried out. Re: to see if everything is working as expected - the only way to really know is through the browser.

Peter
February 20, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

I've seen this and similar error messages in the designer since I started with VS2003. Shortly after I gave up on it and used the HTML view as much as possible. Pretty much the only reason I ever switch to design view is if I need to wire up some even handlers -- I've memorized the signature for some of them -- and when I do that I usually hold my nose at the sight and cross my fingers it won't blow up. It's amazing how easy it is to crash it. The source view has its own bugs though :( Like you said, we keep adding new features on top of a rotting foundation. With VS10 they're going to write it in WPF, and you know what that means: a whole new pile of bugs on top of the old one.

Rick Strahl
February 22, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

Tried the hotfix KB961864 for my routine failures in controls saying they fail to assign simple property values: It still bombs on a regular basis and not just in my controls but also in native ASP.NET controls. No rhyme or reason that I can see when it happens.

Dan
March 16, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

Typically, I see these errors when the user control is exposing properties out that the designer doesn't know how to parse out into their little properties window. It could be a custom class that isn't aliased correctly into the designer's mark-up.

I've seen this also occur if your constructor is doing something that's got a dependency on some external resource or "ambiguous process" (ambiguous, meaning, there's no real good way for the user control to resolve the rendering... such as a constructor for a user control populating results from a web service or data base query)

By the way... You'll get similar errors to this in xaml and winforms under similar conditions.

Spero Larres
October 02, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

I was getting 'Error Creating Control' wrt the GridView. I applied the hotfix KB969612 - FIX: ASP.NET 2.0 rollup package, rebooted, and still got the same error. Then, following advice I saw on another forum, I renamed a folder that my project folder was in a subdirectory of, getting rid of the '#'. So, I renamed it C# -> C_Sharp.

That fixed it, as of 2 minutes ago. Hope the problem doesn't return....

Court Shoell
November 03, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

Solution
So I figured out the problem with controls and the designer not working right. It has something to do with all controls that get loaded into the VS toolbox. Something with the framework gets confused so it cant find them in the GAC. To fix it use Tools-Choose Toolbox Items
hit the reset button. It resets the toolbox tools back to default settings removing any additional tools.

I was then able to drop items on the design window again.

The patch KB969612 everyone is saying to apply didnt work but this did.

You will need to drop the ajaxtoolkit etc. back on to the toolbox.

Hope this helps.

Court

Court Shoell
November 03, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

and one more thing
The designer must use IE
So in explorer resetting defaults Tools-options-Tabbed Browsing- Restore defaults
and
tools-options-adv options-reset

Haseeb Ahmed
December 07, 2009

# re: Error Creating Control Errors in the ASP.NET Designer

Dear All,
Thank you so much i had same issue & it solved now by delete temporary files
May Allah bless all of you

Thank You,
Regards,
Haseeb

James
July 12, 2010

# re: Error Creating Control Errors in the ASP.NET Designer

Hi all,

Had this issue today, all controls were getting this message (I was using DevExpress suite). Previously I've only seen the occassional control, solved by EXIT -> delete ASP.NET cache -> re-enter VS as others have mentioned.

This one was a problem with web.config file, I thought I would add some comments <!-- --> style to a few of the more obscure tags. All working good... Start next day -> enter designer in VS2008 SP1 + getting this message everytime. Removed comments, refreshed page - all good. Quite annoying tho!

mano
March 06, 2011

# re: Error Creating Control Errors in the ASP.NET Designer

I got this error when using Ajax Tool kit. I deleted the temporary files in the Temporary ASP.NET files folder and and put the dll in the [VS 2008 installation Folder]\Common7\IDE\PrivateAssemblies. I am not sure due to which, but the controls are visible in the Designer now. Thank you so much for the help!

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024