This is a migrated thread and some comments may be shown as answers.

Demo and Full Programs Clashing

3 Answers 58 Views
Installer and VS Extensions
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 22 Feb 2011, 04:03 PM
Our company purchased the Telerik tools 9/2010

I have read through the trouble shooting,  but am unable to fix the issue.

Intermittently I get errors rendering the controls.  I searched for the troubleshooting for it in this forum.

I arrived here:

http://www.telerik.com/help/aspnet-ajax/troubleshooting.html

Which tells me to go here: 

http://blogs.microsoft.co.il/blogs/kolbis/archive/2008/06/29/unable-to-cast-object-from-type-x-to-type-x.aspx

Which tells me this:

Unable to cast object from type 'x' to type 'x'

Here is a problem I encountered while working with Visual Studio 2005 and 2008....

The last time this happened to me was while working on TFS custom control. So in order to create a custom control, we must add the assembly we have created and a wicc file to the following folder:

"C:\Documents and Settings\All Users\Application Data\Microsoft\Team Foundation\Work Item Tracking\Custom Controls\9.0"

This is the path where TFS (Team Explorer) will look at when using custom controls.

When I deployed a new version of the custom control to that location I suddenly started receiving the InvalidCastException telling me that it was:

"Unable to cast object of type 'x' to object of type 'x'"

So, what happened here? The common sense tells us that this should be a version issue.

What did I find out?

If you attach to a running instance of VS2005/8 and check what Modules are loaded (you may need to add the Modules window command from the Debug category in Tools --> Customize...) you'll probably see two versions of your assembly are loaded, or even the same version of the assembly loaded twice: in both cases you'll see the same error message.

Why does it happen?

The IDE uses cache to store the assemblies for its projects. The IDE caches versions of assemblies in the following folder:

"x\Documents and Settings\user\Local Settings\Application Data\Microsoft\VisualStudio\8.0\ProjectAssemblies"

And at least in my case doesn't detect the particular assembly containing the type has a new version and it doesn't update the cache.

How do I solve it?

So first step, delete all folders in ProjectAssemblies. Next, make sure the IDE can only find ONE copy of your assembly, which is easier if you only have one copy of the DLL in your disk, and only one reference to it (or exactly the same reference from all projects) in your solution


Which I did.  I had two folders in the location listed above.  Both had telerik.dll in them.

I deleted both,  but the error resumed shortly after,  and both folders are back.

I also, when I create a new TELERIK project,  have  selection of 'TRIAL' or version 2010.2.826.40

I have UNINSTALLED the trial.  I would have assumed that the problem above is that multiple copies of the DLL are getting loaded,  and that is causing the IDE to freak out.  Having uninstalled the telerik DEMO,  I would have thought that would have fixed it. 

Can you please explain how I 'make sure the IDE can only find ONE copy of your assembly, which is easier if you only have one copy of the DLL in your disk'

I am hesitant to upgrade to the latest version because the last thing I want is yet another error being produced due to clashing references.
Thanks
Mason




3 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 22 Feb 2011, 04:37 PM
Hi Mike,

I'm sorry for the inconvenience and the various suggestions of fixes, but the TypeCastException error in design time happens with various circumstances, hence the lack of a single solution.

Anyways, the error is generally a result of different versions of the Telerik.Web.UI assembly loaded in the current Visual Studio AppDomain. In case you work with VS2010 and you always use a single version of RadControls for ASP.NET AJAX (no need for parallel Telerik.Web.UI assemblies), you might find the suggestion below useful:
  • Make sure you only have one version of the Telerik.Web.UI assembly referenced by all the projects in the solution (please, note the assembly description in its property pages too, the Dev and Trial assemblies are still different assemblies);
  • Delete all the assemblies from the %localappdata%\Microsoft\VisualStudio\10.0\ProjectAssemblies folder (close all Visual Studio instances first).
  • Make sure you don't have a different version of the Telerik.Web.UI assembly in the GAC, or in a Visual Studio probing path ([VisualStudioInstallDir]\Common7\IDE\[Public][Private]Assemblies)
  • It is likely that you get this error by the time you upgrade your project: the Visual Studio designer has the older Telerik.Web.UI assembly loaded in the memory and it loads the new one right after the upgrade. In that case, close Visual Studio and delete all the assemblies in the %localappdata%\Microsoft\VisualStudio\10.0\ProjectAssemblies folder

Let me know if that helps.

Kind regards,
Erjan Gavalji
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Mike
Top achievements
Rank 1
answered on 22 Feb 2011, 04:52 PM
Thank you that is helpful.

I have not made the changes yet, but have looked at all directories  etc.

I have two entries in my GAC

Telerik.web.design 2010.2.826.35
Telerik.web.design 2010.2.826.20

Web Settings -> Current used radcontrols version is
v.2010.2.826.40

Should I remove both?  I do not see any entry for .40 anywhere. Will I render my telerik tools un-usable if I delete these entries?

  • Make sure you only have one version of the Telerik.Web.UI assembly referenced by all the projects in the solution (please, note the assembly description in its property pages too, the Dev and Trial assemblies are still different assemblies);

I want to totally remove the 'Trial edition'.  I have uninstalled, and I can not find any references to it. 

What causes this to come up on the list when I select 'new telerik website'.?

I had no entries in the Visual Studio probing paths (Pub or Priv).

Thank you kindly for your quick response.

M2





0
Erjan Gavalji
Telerik team
answered on 23 Feb 2011, 10:48 AM
Hi Mike,

The Telerik.Web.Design assembly entries are added to the GAC by the RadControls for ASP.NET AJAX installer. These are the design-time counterparts of RadControls. They can't be removed manually, but you can run the installer again and unselect the Components for .NET 2.0 and Components for .NET 3.5 feature from the installation. I suggest that you perform the steps below to get only the RadControls assemblies for .NET 4.0 installed to your system:

  • Check your projects and remove all the references to the Telerik.Web.UI assembly (the projects will get broken for a while, so you might find a backup useful);
  • Close all Visual Studio instances;
  • Uninstall RadControls for ASP.NET AJAX through the Programs and Features snap-in of the Control Panel;
  • Run the DEV installer of RadControls for ASP.NET AJAX (the one you downloaded after the purchase);
  • Click Custom when asked for the Setup Type;
  • Unselect the .NET 2.0 and .NET 3.5 components in the Feature List box;
  • Proceed with the installation;
  •  Load your projects in Visual Studio and add references to the Telerik.Web.UI assembly that was just installed.

FYI, there is another Telerik.Web.Design assembly, versioned 2010.2.826.40. As it targets .NET Framework 4.0, it gets added to the .NET 4.0 GAC (located in the C:\Windows\Microsoft.NET\assembly folder instead of the C:\Windows\assembly one).

As per the What causes this to come up on the list when I select 'new telerik website'.? question, can you check the following folder:
%appdata%\Telerik\Updates? Can you delete all its subfolders (please, close Visual Studio first).
The Updates folder contains RadControls for ASP.NET AJAX downloaded through the VSExtensions (the Upgrade Wizard or Create New Project dialogs).

Kind regards,
Erjan Gavalji
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Installer and VS Extensions
Asked by
Mike
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Mike
Top achievements
Rank 1
Share this question
or