Validation (): Element ‘<elementname>’ is not supported.
Contents
The Problem
The Cause
The Solution
Recap: How To Fix Broken IntelliSense
The Problem
Intellisense suddenly stops working for a whole namespace (registered as a tag prefix) of your custom ASP.NET web controls.

When you press Ctrl-Space or Tab, the auto-complete feature of Visual Studio does not suggest your custom control’s properties. Seems like Visual Studio does not recognize your control at all.
I’ve been experiencing this odd behavior for quite some time while working on an ASP.NET demo application prototype, and none of the solutions I’ve been able to find on the Internet seemed to resolve this issue.
Here’s how I’ve registered the “my” tag prefix in web.config:

The “__code” directive specifies that the namespace is located in an assembly that is generated dynamically as a result of the compilation of the App_Code folder. Placing all my custom controls in a separate class library and specifying a fixed assembly name for the tag prefix didn’t help.
Here’s the code for the MyTextbox custom control:

There’s nothing wrong with the code above. The culprit was elsewhere, as I found out later.
My first shot was to try and purge the ReflectedSchemas folder, as described in this thread at the ASP.NET forums. Unfortunately, this didn’t solve the problem in my case. I had also noticed that copying some of my controls to a new project (ASP.NET Website) temporarily resolves the issue until I copy the rest of the old website’s pages and custom controls. So I started a project-wide witch-hunt to find out the offending control or page. After a few hours of struggle, I managed to isolate the custom control that was causing the problem. Excluding the control from the project seemed to resolve the issue. When I included it back, those squirly green lines reappeared in the web-page markup for any of the custom controls defined in the MyControls namespace. So far, so good. I only had to find out the reason why a single custom control was screwing up an entire namespace registered as a tag prefix.
The Cause

The first thing that caught my eye here is the default value attribute that assigns char.MinValue, which is actually the null-terminating character used in C/C++ to designate the end of a string. (Actually, it is also used internally by .NET to mark the end of an underlying unmanaged string but the wrapping System.String class takes care of this automatically and C# developers would rarely come across such issues.) Since Visual Studio uses reflection to generate schemas for intellisense, I could imagine how this null character goes directly into the text content of the schema file. I opened the last generated reflected schema with Notepad++ and here’s what I found:

I made an educated guess that while reading in the reflected schema to generate intellisense information for the MyControls namespace, Visual Studio was unable to read further than this null-terminating character, hence anything that comes after is omitted and the whole schema is either discarded, or somehow rendered invalid.
To prove this concept to myself, I created a simple test application:
The Solution
What I did next is globally search and replace char.MinValue with another, less dangerous character (e.g. ’0′):

After rebuilding the project, intellisense was finally back:

Recap: How To Fix Broken IntelliSense
If you have problems with intellisense and auto-complete in ASP.NET projects:
- Close Visual Studio.
- Delete all files under
C:\Documents and Settings\[Username]\Application Data\Microsoft\VisualStudio\9.0\ReflectedSchemas
- Delete all files under
C:\Documents and Settings\[Username]\Application Data\Microsoft\VisualStudio\9.0\ReflectedTypeLibs
- Delete all files under
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
- Make sure none of your custom controls has a property attributed with a default value of char.MinValue (null-terminating character).













