Windows Forms Out-of-process designer can't make use of transitive references
See original GitHub issueEnvironment
Visual Studio Professional 2022 (64-bit) Version 17.4.0
.NET version
.NET 6.0
Did this work in a previous version of Visual Studio and/or previous .NET release?
Works as soon as .NET Framework is used in the same projects. Does also work with multitargeting.
Issue description
The new out-of-process Windows Forms designer shows the following error when the base form of the form that is currently opened in the designer implements an interface from a transitive referenced project:
It took me quite a while to hunt this down but it seems that the new designer shows this error if …
- the form in question is derived from a base form (from the same or another project)
- the base form implements an interface
- the interface is defined in another project
- the other project is referenced over an transient project reference
In this case the base form still can be designed. The designer however crashes when openening the derived form. The error disappears as soon a direct project reference is added.
References overview
More details and a repro under https://github.com/awaescher/DesignerVsInterfaces
Steps to reproduce
- clone the repository https://github.com/awaescher/DesignerVsInterfaces
- build
- open the designer for both base forms: should work
- open the designer for GoodDerivedForm: should work
- open the designer for BadDerivedForm: should cause the error shown above
Diagnostics
// complete log when opening BadDerivedForm from the repro repository
[09:19:17.934946] info: Creating VsDesignerLoader
[09:19:17.938946] trce: Sending request: Sessions/Create
[09:19:17.939981] trce: Sessions/Create took 00:00:00.0015269.
[09:19:17.940945] trce: Sending request: Options/SetOptions
[09:19:17.940945] trce: Options/SetOptions took 00:00:00.0007348.
[09:19:17.941961] trce: Sending request: Sessions/BeginLoad
[09:19:17.941961] trce: Sessions/BeginLoad took 00:00:00.0005457.
[09:19:17.959431] trce: Sending request: Sessions/DesignerActivated
[09:19:17.960400] trce: Sessions/DesignerActivated took 00:00:00.0007037.
[09:19:18.044542] info: Created VsCodeDomProvider for 'C:\Users\daw\Source\repos\DesignerVsInterfaces\DesignerVsInterfacesUI\BadDerivedForm.cs'
[09:19:18.049542] info: Created VsCodeDomProvider for 'C:\Users\daw\Source\repos\DesignerVsInterfaces\DesignerVsInterfacesUI\BadDerivedForm.Designer.cs'
[09:19:18.050543] trce: ProcessNamespace: DesignerVsInterfacesUI
[09:19:18.051543] trce: ProcessClass: BadDerivedForm
[09:19:18.052543] trce: ProcessConstructor
[09:19:18.053542] trce: ProcessNamespace: DesignerVsInterfacesUI
[09:19:18.054542] trce: ProcessClass: BadDerivedForm
[09:19:18.055542] trce: ProcessField: components
[09:19:18.057542] trce: ProcessMethod: Dispose
[09:19:18.058543] trce: ProcessMethod: InitializeComponent
[09:19:18.059542] trce: Sending request: Sessions/FindDesignableClass
[09:19:18.061560] trce: Sessions/FindDesignableClass took 00:00:00.0022300.
[09:19:18.061560] fail: Request failures: Sessions/FindDesignableClass.
Microsoft.DotNet.DesignTools.Client.DesignToolsServerException: The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: \r\n
BadDerivedForm --- The base class 'DesignerVsInterfacesUI.BaseFormReferencingBaseLibrary' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.
For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[09:19:18.065425] trce: Updating selection in server process.
[09:19:18.065425] trce: Sending request: Selection/UpdateSelection
[09:19:18.066433] trce: [DesignerVsInterfacesUI]: Attempting to update selection: 0 components, Replace
[09:19:18.066433] trce: [DesignerVsInterfacesUI]: Made change: False
[09:19:18.066433] trce: Selection/UpdateSelection took 00:00:00.0007927.
[09:19:18.066433] trce: Sending request: Sessions/Unload
[09:19:18.067067] trce: Sessions/Unload took 00:00:00.0004503.
[09:19:18.067067] trce: Sending request: Sessions/EndLoad
[09:19:18.067067] trce: Sessions/EndLoad took 00:00:00.0004010.
[09:19:23.422459] trce: [DesignerVsInterfacesUI]: Sending request to remove roots:
- 289: 1 root(s).
...
- 1d9: 2 root(s).
- 1d8: 6 root(s).
[09:19:23.422459] trce: Sending request: Objects/RemoveObjectRoots
[09:19:23.425472] trce: [DesignerVsInterfacesUI]: Objects/RemoveObjectRoots request received for 293 object(s).
- 289: 1 root(s).
...
- 1d9: 2 root(s).
- 1d8: 6 root(s).
[09:19:23.425472] trce: Objects/RemoveObjectRoots took 00:00:00.0033258.
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Custom Controls for WinForm's Out-Of-Process Designer
Everything from the Developer's perspective seems to actually be done server-side, and you can reuse most of the existing control designer Code.
Read more >NuGet Package Dependency Resolution
This process is referred to as transitive restore. Reinstalling or restoring packages is then a process of downloading the packages listed in ...
Read more >TransitiveDependencies not found when devexpress.win ...
This used to work just fine. I could have Devexpress.Win.Design package present but excluded for "runtime", and also have Devexpress.
Read more >State of the Windows Forms Designer for .NET Applications
The Windows Forms designer for .NET applications is here, the blog post will give you insights into the new architecture and changes been ......
Read more >Windows Forms Designer Crashes Visual Studio, can't find ...
In the Windows Forms application, there is a form (MySuperForm) ... references it (package references bubble up the transitive dependency).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@awaescher - thank you for the detailed repro case, it was very helpful. The fix for this issue is in the pipeline targeting the December patch Tuesday for VisualStudio 2022 17.4 release
@Shyam-Gupta will be taking a look at this in a few days. I’ll make sure it’s on his radar. @Olina-Zhang thanks for the confirmation link!