Recently we discovered that Visual Studio can sporadicaly display the
"Error rendering control" message in design time.
This can occur in several specific error messages:
- [A]Telerik.Web.UI.RadScriptManager cannot be cast to
[B]Telerik.Web.UI.RadScriptManager. Type A originates from...
- Unable to cast object of type 'Telerik.Web.UI.RadScriptManager'
- Unable to cast object of type Telerik.Web.UI.[ControlName] to
The screenshots below demonstrate sample occurrences of the error:
A subsequent close of the page in design time and a further reload
usually might make it render correctly. A further close and reload can
cause the error to reappear though.
Our research showed that some registry entries we use to enable Visual
Studio display RadControls in the "Add Reference" and "Choose ToolBox
Items" dialogs are the reason for the error. It seems that for some
reason Visual Studio loads several instances of the Telerik.Web.UI
assembly into its AppDomain, which results in the error above.
We decided to sacrifice the appearance of the Telerik.Web.UI assembly in
the above mentioned dialogs, but prevent this annoying error from
happening and we already removed the registry entries from the
As a fix in the meantime, you could use the .reg files in the attached
archives (one targets a 32-bit machine and the other targets a 64-bit
one) and the .bat files (targeting Windows XP and Windows7/Vista
respectively) to fix the problem. Here are the steps to follow:
- Download and extract the archive to a folder of your choice
- Close all Visual Studio instances
- Double-click the .reg file (use the
Remove_AssemblyFoldersEx_32bitMachine.reg for 32-bit machines and the
Remove_AssemblyFoldersEx_64bitMachine.reg one for 64-bit machines) and
click the 'Yes' button when asked to confirm the registry entry merge
- Double-click the bat file, depending on the Windows system
you're running (use the ClearProjectAssemblies_Win7_Vista.bat for
Windows7/Vista and the ClearProjectAssemblies_WinXP.bat for Windows XP)
- Start Visual Studio and load your project