WinForms: Generic forms don't open anymore in designer in .NET 7

144 Views Asked by At

In order to be sure that it's .NET 7 (.NET Core) related, I created a project with .NET 4.7.2 with a generic base form and a derived one. Both can be opened and are shown properly. Only in .NET 7 it's not working anymore. When trying to open the base form I get

The designer could not be shown for this file because none of the classes within it can be designed.

When trying to open the derived form I get

Cannot create an instance of WinFormsApp2.Form1`1[TEntity] because Type.ContainsGenericParameters is true.

Why is that, just in .NET Core?

I found something about "UseLegacyPathHandling" which I added to C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe.config:

<AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false" />

But that didn't help.

0

There are 0 best solutions below