KB Article T923824
Visible to All Users

DevExpress WinForms Troubleshooting - Visual Studio Design Time

Cheat Sheets, Best Practices and Troubleshooting


Based on our experience, exceptions and other issues that occur at Visual Studio design time are usually not directly related to our components. In this article, you will find information on most common issues that occur at design time and ways to resolve them.

First Steps

Make sure that the installed version of DevExpress components is compatible with the Visual Studio version you are using. Please refer to the IDE section in the following help topic for a table of Visual Studio versions supported by DevExpress WinForms Controls Prerequisites. If the versions are compatible, but the issue still occurs, close all opened documents in Visual Studio, rebuild and clean your solution, remove Bin and Obj folders and licenses.licx file, and restart Visual Studio. If it does not help, please refer to the Known Issues list below.

.NET 6+

If a Visual Studio designer issue occurs in a .NET 6+ application, refer to the following help topic: Design-Time Support for DevExpress WinForms Controls for .NET - FAQ

Known Issues:

Issue 1. A form or control is not loaded in Visual Studio designer after an update to a newer version. The following errors occur:

  • The type 'X' exists in both assemblies
  • Type 'X' is ambiguous in the namespace 'Y'
  • [A] cannot be cast to [B]. Type A originates from 'X' in the context 'Default'…
  • Error CS0012 The type 'X' is defined in an assembly that is not referenced. You must add a reference to assembly 'Y'
  • Error Creating Control
  • The call is ambiguous between the following methods or properties: X and Y
  • NullReferenceException in DevExpress.XtraEditors.Repository.RepositoryItem.CreateDesigner:
    at DevExpress.XtraEditors.Repository.RepositoryItem.CreateDesigner()
    at DevExpress.XtraEditors.Repository.RepositoryItem.FilterProperties(PropertyDescriptorCollection collection)
    at DevExpress.XtraEditors.Repository.RepositoryItem.System.ComponentModel.ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
    at System.ComponentModel.TypeDescriptor.MergedTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties(Attribute[] attributes)

Possible cause and solution: Such issues may occur if a project wasn't updated completely. To resolve this issue, do the following:

  • Close all currently opened designers
  • Clear the Bin and Obj folders
  • Remove the licenses.licx file
  • Run Project Converter again. Ensure that all projects in your solution and all DLLs that use our components (directly or indirectly) are updated and reference required DevExpress assemblies
  • Restart Visual Studio
  • Rebuild your project

In addition, refer to the following help articles:
Upgrade Notes
How to resolve issues after updating DevExpress controls: Type 'X' exists in both assemblies vs Type 'X' is ambiguous in namespace 'Y'

Issue 2. A form or control is not loaded in Visual Studio designer after an update to a newer version. The following error occurs:

  • Could not find type “xxx”. Please make sure that the assembly that contains this type is referenced.
  • The designer could not be displayed for this file because none of the classes it contains can be designed. The designer checked the following classes in the file: "xxx" — The base class “yyy” could not be loaded. Make sure the assembly is referenced and that all projects have been built.

This error may occur when you are using the Splash Screen Manager component with a custom Wait Form or Splash Screen.

Possible cause and solution 1:

This error can be reproduced with all .NET controls and is widely discussed on the web and on our forum:
Could not find type 'xxx.xxx.xxx'. Please make sure that the assembly
Message 'Could not find type WaitForm1. Please make sure that the assembly of this type is referenced…'
Visual studio designer in x64 doesn't work

Visual Studio is a 32-bit application. To visualize a form, it has to load all referenced assemblies at design time. If the Platform target option is set to x64, Visual Studio cannot load the compiled 64-bit assembly in its 32-bit environment. To overcome this shortcoming, temporarily set the Platform target option to Any CPU to finish configuring controls at design time. If you are using our SplashScreenManager component and the error occurs with the WaitForm or SplashScreen type, you can configure SplashScreenManager at runtime (in code).

Possible cause and solution 2:

This error may occur since the project's framework version is not compatible with the version of installed components. Usually, this error accompanied by the following messages:

  • Error CS0246 The type or namespace name 'DevExpress' could not be found (are you missing a using directive or an assembly reference?)
  • The primary reference "X" could not be resolved because it has an indirect dependency on the assembly "Y" which was built against the ".NETFramework,Version=v4.5.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0"

To resolve the issue, change the .NET Framework version to the one compatible with installed components: Prerequisites.

Issue 3. A form or control is not loaded at design time and Visual Studio designer shows an error. The following error occurs:

  • The designer loader did not provide a root component but has not indicated why.

Possible cause and solution: This error may occur due to a design-time exception.

We recommend the following:

  • Collect the exception’s call stack as described in the following help article: How to obtain a design-time exception call stack.
  • If the error occurs in a standard .NET method, ensure that the issue is not related to your custom code (you can comment your custom code out to check this). Then, copy the top line of the call stack or the error message and search for it on the web or in our Support Center: https://search.devexpress.com/.
  • If the error occurs in a DX method, there is a chance that we already discussed a similar issue and found a solution. Search for the call stack and error message description on the web and in our search engine.
  • If you could not find any information about the error on the web or in our Support Center and resolve the issue, please post a new ticket and share as much information as possible (call stack, steps to reproduce, a project where the issue is reproducible). This information will help us determine the cause in the fastest and most straightforward way.

Issue 4. Other errors or exceptions that occur in Visual Studio designer and are not listed in this article.

Possible solution: Most likely, you can use steps from the previous section to resolve the issue.

We also recommend that you refer to the following help article that helps troubleshoot such problems as well: How to investigate an issue and determine why it occurs in your project.

Issue 5. Visual Studio operates slowly or freezes.

Possible cause and solution: This error may occur due to a design-time exception, because of a Visual Studio extension or Document Outline.

We recommend the following:

  • Temporary disable all VS extensions to ensure that they do not affect the behavior.
  • Disable the Document Outline window to check if it resolves the issue.
  • Use steps from the previous section.
  • Components are not shown in the Toolbox.

  • The "HRESULT E_FAIL has been returned from a call to a COM" error is thrown when a component is dropped from the Toolbox.

  • The "Unable to find a type reference that is appropriate for this file:" error on dropping a component from Toolbox

  • Any other error or exception occurs when Toolbox is loaded or when a component is dropped from the Toolbox.

Possible solution:

  • Make sure that the version of your components is compatible with your Visual Studio version. Please refer to the following help article for more information: Prerequisites. If the version of your components is not compatible with your Visual Studio version, consider using another Visual Studio version.
  • Starting with v18.2, our components are built against .Net Framework 4.5.2. Thus, they can be used only in projects that target .Net Framework 4.5.2+. See Prerequisites for additional information on system requirements. Make sure that your project's Target framework (Right click on Project -> Properties -> Application) is set to .Net Framework 4.5.2 or newer.
  • Try repairing the Toolbox by clicking the Repair Toolbox command in the Visual Studio Toolbox context menu. The following article describes all possible solutions: How to resolve issues with Toolbox items.

Issue 7. The size of components unexpectedly changes at design time:

  • Grid column widths are increased every time you open the Visual Studio designer.

  • Control size is different when you run your application on another machine.

Possible cause and solution: This behavior usually takes place if you design your application on a screen with non-default DPI settings (more than 100%)

To resolve the issue, do the following:

Issue 8. Form surface isn't displayed in the designer window.

Possible cause and solution: This behavior can take place if the component tray overlaps the form. Thus, the form is displayed under it.

Check whether the component tray height ($this.TrayHeigh) is serialized in your form resources. If so, set the height to a smaller value.

The issue is not on the Known Issues list:

If the issue you are facing is not described above, try the following steps to resolve it.

Steps:

  • Look for similar issues, errors and solutions on the web, Stack Overflow, in Design-Time Errors in the Windows Forms Designer or in our Search Engine.
  • If you could not find any information about the error on the web or in our Search Engine and resolve the issue, please post a new ticket in our Support Center and share as much information as possible (call stack, steps to reproduce, a project where the issue is reproducible). This information will help us determine the cause of the issue in the fastest and most straightforward way.

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.