We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to resolve "System.InvalidCastException: Unable to cast object of type 'Syncfusion.Windows.Forms.Tools.XPMenus.XPMenusProvider' exception?"

Root Cause

The exception with "System.InvalidCastException: Unable to cast object of type Syncfusion.Windows.Forms.Tools.XPMenus.XPMenusProvider" occurs only in the following scenarios,

  • If the project is created under older version and migrated with later version.
  • If the project is migrated from different versions of framework i.e. 2.0 to 4.0

Solution

You can refer to the following steps in your system to resolve your issues.

  • Open <Essential Studio> Dashboard.
  • Run the AssemblyManger with Removeallversion option. This removes all the Syncfusion assemblies from GAC and public assemblies’ folder.
  • When you find any Syncfusion assemblies in Global Assembly Cache (GAC), you can remove all the Syncfusion assemblies manually.
  • Install the {required version} assemblies.
  • For example, your Target Framework is 3.5, then you can remove 4.0 and 2.0 Syncfusion assemblies from GAC and assemblies folder and vice versa.
  • Check only required framework assemblies are in GAC (c:\windows\assembly) and also in assemblies folder (C:\Program Files\Syncfusion\Essential Studio\<Product Version> \Assemblies\3.5) (You can choose your respective Target Framework)
  • Open the <Essential Studio> dashboard.
  • Run the Multi Target Framework targeting to 3.5. (You can choose your respective Target Framework)
  • Click OK once operation is completed successfully.
  • Also you can use Toolbox Configuration in Dashboard to install the Syncfusion Tools in Visual Studio

Remove the older version dlls from your application that is found in ReportLib project folder. This should cause the error on handling the form in designer mode to add a new Syncfusion control. Also ensure the older assembly does not get reflected anywhere in the project.

Refer to the following steps to upgrade projects.

  • Remove Bin and Obj folder from Project path.
  • Open the Visual studio IDE and open a project.
  • Rebuild your project.
  • You check that the Syncfusion assemblies are referring to Product Version(Essential Studio)
  • The issue is resolved.

For project Migration, refer to the following link

How to change the project into a new Syncfusion version?

When the issues still exist, you can get the license key manager details that can be achieved by using the following steps.

  • Open the dashboard.
  • Select license manager option that is on left side menu at the bottom.
  • Then press the launch button.
  • Pop-up dialog box is displayed that contains key. Select the key that brings up the details of the selected key and send those key details to us to analyze further and provide better solution.

Note: If still the issue exists, perform a full textual search for old Syncfusion version references in the project. If anything exists, clean all those project files manually and add the correct references.

Article ID: Published Date: Last Revised Date: Platform: Control:
3199 01/12/2015 01/13/2015 WinForms GridControl
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon