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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to resolve an InvalidCastException?

Platform: WinForms |
Control: GridGroupingControl
Tags: xpmenu, exception

Resolve an InvalidCastException

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,

1. If the project is created under older version and migrated with later version.

2. If the project is migrated from different versions of framework i.e. 2.0 to 4.0


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

1. Open <Essential Studio> Dashboard.

2. Run the AssemblyManger with Removeallversion option. This removes all the Syncfusion assemblies from GAC and public assemblies’ folder.

3. When you find any Syncfusion assemblies in Global Assembly Cache (GAC), you can remove all the Syncfusion assemblies manually.

4. Install the {required version} assemblies.

5. For example, your Target Framework is 3.5, then you can remove 4.0 and 2.0 Syncfusion assemblies from GAC and assembly’s folder and vice versa.

6. 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)

7. Open the <Essential Studio> dashboard.

8. Run the Multi Target Framework targeting to 3.5. (You can choose your respective Target Framework)

9. Click OK once operation is completed successfully.

10. 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.

1. Remove Bin and Obj folder from Project path.

2. Open the Visual studio IDE and open a project.

3. Rebuild your project.

4. You check that the Syncfusion assemblies are referring to Product Version (Essential Studio)

5. The issue is resolved.

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

1. Open the dashboard.

2. Select license manager option that is on left side menu at the bottom.

3. Then press the launch button.

4. 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.

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.

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment
Junfan Yan
May 13, 2015
The issue is still there although I've followed all the solution steps. Reply

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile