vs2022 error - The designer could not be shown for this file because none of the classes within it can be designed. The base class 'System.Void' cannot be designed.

Joe Ryan 0 Reputation points
2025-11-13T15:19:46.8733333+00:00

migrating from VS2012 to vs2022 and get this error on VB project

The designer could not be shown for this file because none of the classes within it can be designed. The base class 'System.Void' cannot be designed.

Developer technologies | Visual Studio | Setup
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-11-13T15:20:07.4233333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error you're encountering, "The designer could not be shown for this file because none of the classes within it can be designed. The base class 'System.Void' cannot be designed," typically indicates that the designer is unable to load a class because it is not a valid designable class. In this case, it seems that the base class is incorrectly set to System.Void, which is not a valid base class for a form or control.

    To resolve this issue, you should check the following:

    1. Ensure that the class is inheriting from a valid base class: Make sure that your form or control class is inheriting from a class that can be designed, such as System.Windows.Forms.Form for Windows Forms applications.
    2. Check for any incorrect declarations: Look for any declarations in your code that might mistakenly set the base class to System.Void or any other non-designable class.
    3. Rebuild the project: Sometimes, simply rebuilding the project can resolve issues with the designer not recognizing changes in the code.
    4. Review the designer file: Ensure that the designer file associated with your form or control is correctly set up and does not contain any errors that might prevent the designer from loading.

    If these steps do not resolve the issue, consider creating a new form and copying the code over, as this can sometimes help to reset any underlying issues with the designer files.


    References:

    0 comments No comments

  2. Varsha Dundigalla(INFOSYS LIMITED) 3,885 Reputation points Microsoft External Staff
    2025-11-14T07:10:25.5666667+00:00

    Thank you for reaching out.

    Steps for debugging.

    Build

    • Rebuild Solution → fix all compile errors (including base/custom controls).

    Clean

    • Close all Designer tabs → Build > CleanBuild > Rebuild.
    • Delete bin/ and obj/ in affected projects → reopen → rebuild.

    Caches

    • Close VS → delete %LocalAppData%\Microsoft\VisualStudio\17.*\ComponentModelCache → start VS. [github.com]

    Designer diagnostics

    • Tools > Options > Windows Forms Designer > Logging Level = Verbose → open the form → check Output > Windows Forms for type‑load/assembly errors.
    • If startup is slow: increase Windows Forms Designer > Connection timeout. [stackoverflow.com]

    Class/partial integrity

    • In <Form>.vb/<Form>.cs:
    • Partial Class <Name> + Inherits System.Windows.Forms.Form (or the correct base).
    • Match namespace and partial name in <Form>.Designer.vb/.Designer.cs.
      • Confirm InitializeComponent is a parameterless Sub/void inside the same partial.

    Design‑time safety

    • Move file/DB/network/DI setup out of constructors/field initializers; guard design‑time execution per designer guidance. [stackoverflow.com]

    Custom controls

    • Ensure each custom control builds, has a parameterless constructor, and doesn’t run runtime‑only work at design time; remove failing controls to isolate.

    Targeting & migration

    • Classic WinForms/WPF on .NET Framework: target .NET Framework 4.8 and confirm workloads.
    • If upgraded from older VS, follow Port/Upgrade guidance; reopen and rebuild.

    Designer error panel

    • Use the yellow Designer error banner links to jump to exact lines; fix → Clean/Rebuild → re‑open Designer. [stackoverflow.com]

    References

    Please let us know if you require any further assistance, we’re happy to help.

    If you found this information useful, kindly mark this as "Accept Answer".


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.