System.Void may not be used as a type argument

Al Bourque 5 Reputation points
2026-07-06T19:36:46.4566667+00:00

When I attempt to open a form in designer (.Net 2026 c#), I get a "System.Void may not be used as a type argument" error. IF I click on "ignore and Continue" the form opens correctly. Why is this?

Developer technologies | Windows Forms

2 answers

Sort by: Most helpful
  1. Al Bourque 5 Reputation points
    2026-07-07T11:19:58.37+00:00

    The issue has been resolved. Since I moved to a different development system on a different laptop, for some reason I needed to rebuild one of my bindings. The binding source was set to System.Void. I repointed the binding to the correct class structure, and then I had to re-align my data grid. Once I did this the problem went away. Thanks for the help.

    Was this answer helpful?

    0 comments No comments

  2. Nancy Vo (WICLOUD CORPORATION) 7,495 Reputation points Microsoft External Staff Moderator
    2026-07-07T04:21:21.8466667+00:00

    Hello @Al Bourque ,

    Thanks for your question.

    Visual Studio has two separate tools working behind the scenes. One tool runs your actual code (the Compiler), and a completely different tool draws your visual screen (the Designer).

    When you moved to the 2026 version, the Designer tool got a little confused while trying to read the BindingSource data. It temporarily forgot what type of data is supposed to be in there. When it doesn't know the data type, it guesses "Nothing". C# rules strictly forbid using System.Void as a physical object type, so the Designer throws an error and stops drawing.

    The confusion only exists inside the visual Designer tool. When you skip the warning, the actual Compiler takes over, finds your correct data types, and everything works normally.

    You can refer to these following steps:

    1. Close the form designer.
    2. Go to the top menu and click Build > Clean Solution, and then Build > Rebuild Solution.
    3. Open the form again.
    4. If it still happens, click "Ignore and Continue", click on your lLAClassBindingSource at the bottom, go to the Properties panel, change the DataSource to (none), and then change it right back to your data class. This forces the Designer to write the correct type into the code and stop guessing System.Void.

    For more detailed information, you can refer to Resolve errors and warnings related to generic type parameters and generic type arguments.

    I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.

    Was this answer helpful?


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.