Designer not loading: System.InvalidOperationException: Designer load encountered an error. Please ensure that the project can be built successfully.
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 103
Description
### Environment
Microsoft Visual Studio Enterprise 2022 (64-bit) - Preview
Version 17.10.0 Preview 1.0
### .NET version
.NET 8.0
```
WinExe
net8.0-windows
enable
true
enable
```
### Did this work in a previous version of Visual Studio and/or previous .NET release?
Can't recall it worked
### Issue description
Following commands were already exceuted.
```
Add-MpPreference -ExclusionProcess 'devenv.exe'
Add-MpPreference -ExclusionProcess 'DesignToolsServer.exe'
```

However, closing Visual Studio and reopening seems to solve the issue.
### Steps to reproduce
1. Create a Windows Forms Application
### Diagnostics
```text
[09:49:13.627374] info: Creating VsDesignerLoader
[09:49:13.718618] info: [Thread 1] Creating design-time ITypeResolutionService.
[09:49:13.756584] info: Start processing enqueued assemblies
[09:49:13.756584] trce: Loaded Microsoft.WinForms.DesignTools.Protocol in 00:00:00.0000078 [thread 69]
[09:49:13.757587] trce: Processed 'Microsoft.WinForms.DesignTools.Protocol' in 00:00:00.0008524
[09:49:13.759587] info: Added 'Microsoft.WinForms.DesignTools.Protocol'
[09:49:13.759587] trce: Loaded Microsoft.WinForms.DesignTools.Client in 00:00:00.0000059 [thread 69]
[09:49:13.765588] trce: Processed 'Microsoft.WinForms.DesignTools.Client' in 00:00:00.0053722
[09:49:13.766587] info: Added 'Microsoft.WinForms.DesignTools.Client'
[09:49:13.781584] info: BasicDesignerLoader.BeginLoad - Setting _loadDependencyCount to 0.
[09:49:13.783619] info: BasicDesignerLoader::BeginLoad - Calling AddLoadDependency
[09:49:13.787620] info: VsDesignerLoader::PerformLoad - Calling AddLoadDependency.
[09:49:13.790601] info: BasicDesignerLoader::BeginLoad - Calling DependentLoadComplete
[09:49:14.051632] info: Visual Studio culture: en-US (0x0409)
[09:49:14.051632] info: [Thread 10] Launching server...
[09:49:14.056631] info: Is processor architecture ARM64: False
[09:49:15.460926] info: Added 'mscorlib'
[09:49:15.460926] trce: Loaded System.Windows.Forms in 00:00:00.0000202 [thread 70]
[09:49:15.463925] trce: Processed 'System.Windows.Forms' in 00:00:00.0028683
[09:49:15.480926] info: Added 'System.Windows.Forms'
[09:49:15.480926] trce: Loaded System in 00:00:00.0000111 [thread 70]
[09:49:15.481923] trce: Processed 'System' in 00:00:00.0007721
[09:49:15.500607] info: Added 'System'
[09:49:15.500607] trce: Loaded System.Drawing in 00:00:00.0000076 [thread 70]
[09:49:15.500607] trce: Processed 'System.Drawing' in 00:00:00.0000938
[09:49:15.502608] info: Added 'System.Drawing'
[09:49:15.502608] trce: Loaded System.Design in 00:00:00.0000071 [thread 70]
[09:49:15.516231] trce: Processed 'System.Design' in 00:00:00.0142382
[09:49:15.527923] info: Added 'System.Design'
[09:49:15.527923] trce: Loaded System.Drawing.Design in 00:00:00.0000115 [thread 14]
[09:49:15.527923] trce: Processed 'System.Drawing.Design' in 00:00:00.0001963
[09:49:15.527923] info: Added 'System.Drawing.Design'
[09:49:16.329565] fail: OutputGroupService didn't return output group DesignerRuntimeImplementationProjectOutputGroup.
For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[09:49:16.329565] fail: Could not retrieve DesignerRuntimeImplementationProjectOutputGroup for current project.
For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[09:49:16.337555] fail: System.InvalidOperationException: Designer load encountered an error. Please ensure that the project can be built successfully.
at Microsoft.DotNet.DesignTools.Client.Host.ProjectInfoProvider.NetCore.d__6.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.ProjectInfoProvider.d__9.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.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.d__29.MoveNext()
For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[09:49:16.359110] info: VsDesignerLoader::PerformLoad::LoadCompletionTask - Calling DependentLoadComplete.
[09:49:16.366109] warn: Cannot update selection in server process as Session is not connected.
```
Contributor guide
Assessment
This issue has not been assessed yet.