VS 2022 can not load designer for .Net 5 and Higher winforms projects

666 views Asked by At

My Visual Studio 2022 version 17.7.5 (the latest version) can not load Winforms within WinFormsApp projects. Everything is OK within .NET Framework Winforms project, but not with the Core frameworks such as .NEt5, .Net6 and .Net7.

It will stuck at Loading Designer... and will give these errors in the output window:

[12:27:38.057108] fail: [WinFormsApp145]: Invalid value for dpi: 0

                        For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[12:29:35.944976] fail: [WinFormsApp145]: Timed out while connecting to named pipe: DesignToolsServer.b87b8818-7740-468a-bbff-0844b600f8a3

                        For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[12:29:35.958968] fail: Microsoft.DotNet.DesignTools.Client.ServerException: Timed out while connecting to named pipe.
                           at Microsoft.DotNet.DesignTools.Client.Host.ServerProcess.<ConnectToStreamAsync>d__35.MoveNext()
                        --- End of stack trace from previous location where exception was thrown ---
                           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                           at Microsoft.DotNet.DesignTools.Client.Host.ServerProcess.<LaunchAsync>d__28.MoveNext()
                        --- End of stack trace from previous location where exception was thrown ---
                           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                           at Microsoft.DotNet.DesignTools.Client.Host.ServerHostFactory.<CreateHostAsync>d__8.MoveNext()
                        --- End of stack trace from previous location where exception was thrown ---
                           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                           at Microsoft.DotNet.DesignTools.Client.DesignToolsClientLoader.<CreateClientAsync>d__29.MoveNext()

                        For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[12:29:36.215821] warn: Cannot update selection in server process as Session is not connected.

also I enabled the verbose log messages and here is the result:

[11:24:10.840322] info: Creating VsDesignerLoader
[11:24:11.224447] info: [Thread 1] Creating design-time ITypeResolutionService.
[11:24:11.380279] trce: Current VS Version = 17.0
[11:24:11.385277] info: Start processing enqueued assemblies
[11:24:11.385277] trce: Loaded Microsoft.WinForms.DesignTools.Protocol in 00:00:00.0000140 [thread 30]
[11:24:11.389273] trce: Processed 'Microsoft.WinForms.DesignTools.Protocol' in 00:00:00.0042090
[11:24:11.393271] info: Added 'Microsoft.WinForms.DesignTools.Protocol'
[11:24:11.394271] trce: Loaded Microsoft.WinForms.DesignTools.Client in 00:00:00.0000122 [thread 30]
[11:24:11.429252] trce: Processed 'Microsoft.WinForms.DesignTools.Client' in 00:00:00.0352671
[11:24:11.431250] info: Added 'Microsoft.WinForms.DesignTools.Client'
[11:24:11.683106] info: Visual Studio culture: en-US (0x0409)
[11:24:11.683106] info: [Thread 30] Launching server...
[11:24:11.701095] info: Is processor architecture ARM64: False
[11:24:12.607580] info: Added 'mscorlib'
[11:24:12.607580] trce: Loaded System.Windows.Forms in 00:00:00.0000117 [thread 15]
[11:24:12.608579] trce: Processed 'System.Windows.Forms' in 00:00:00.0005809
[11:24:12.631565] info: Added 'System.Windows.Forms'
[11:24:12.631565] trce: Loaded System in 00:00:00.0000142 [thread 15]
[11:24:12.632564] trce: Processed 'System' in 00:00:00.0005263
[11:24:12.658549] info: Added 'System'
[11:24:12.658549] trce: Loaded System.Drawing in 00:00:00.0000142 [thread 30]
[11:24:12.658549] trce: Processed 'System.Drawing' in 00:00:00.0000622
[11:24:12.661548] info: Added 'System.Drawing'
[11:24:12.661548] trce: Loaded System.Design in 00:00:00.0000110 [thread 30]
[11:24:12.662548] trce: Processed 'System.Design' in 00:00:00.0006612
[11:24:12.678539] info: Added 'System.Design'
[11:24:12.678539] trce: Loaded System.Drawing.Design in 00:00:00.0000149 [thread 86]
[11:24:12.678539] trce: Processed 'System.Drawing.Design' in 00:00:00.0000216
[11:24:12.678539] info: Added 'System.Drawing.Design'
[11:24:16.674259] info: Shadow cache base directory: C:\Users\User\AppData\Local\Microsoft\VisualStudio\17.0_021c9b12\WinFormsDesigner
[11:24:16.700243] info: [WinFormsApp1TEST]: Preparing shadow cache folder.
[11:24:16.702242] info: [WinFormsApp1TEST]: NetCoreServerLayout - Platform: AnyCPU, Normalized PlatformName: x64
[11:24:16.706239] info: [WinFormsApp1TEST]: Copying design tools server common files from: 'c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\windows.forms\DesignToolsServer\Common'.
[11:24:16.817177] info: [WinFormsApp1TEST]: Copying design tool server platform-specific files from: 'c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\windows.forms\DesignToolsServer\x64'.
[11:24:16.836166] info: [WinFormsApp1TEST]: Copying 'E:\#Projects\WinFormsApp1TEST\WinFormsApp1TEST\obj\Debug\net7.0-windows\WinFormsApp1TEST.designer.deps.json' to 'DesignToolsServer.deps.json'
[11:24:16.840164] info: [WinFormsApp1TEST]: Copying 'E:\#Projects\WinFormsApp1TEST\WinFormsApp1TEST\obj\Debug\net7.0-windows\WinFormsApp1TEST.designer.runtimeconfig.json' to 'DesignToolsServer.runtimeconfig.json'
[11:24:16.922117] info: Shadow caching completed.
[11:24:16.946103] info: IServerConnectionTimeoutProvider: Starting execution of winFormsOptions task.
[11:24:16.949101] info: Obtained ServerConnectionTimeout value: 120000.
[11:24:16.949101] info: Obtained OutputWindowLoggingService.
[11:24:16.982083] info: [WinFormsApp1TEST]: Launching design tools server process...
[11:24:21.229659] fail: [WinFormsApp1TEST]: Invalid value for dpi: 0

where is the problem? some friends told me to uninstall the whole VS and reinstall it again. But I'm looking for the reason which causes this issue.

0

There are 0 answers