WinForms Designer cannot design From inheriting from another Form
See original GitHub issue- .NET Core Version:
.NET SDK (reflecting any global.json):
Version: 5.0.100
Commit: 5044b93829
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100\
Host (useful for support):
Version: 5.0.0
Commit: cf258a14b7
.NET SDKs installed:
5.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
-
VS: 2019 16.9 Preview 1 Community
-
Have you experienced this same bug with .NET Framework?: No. On .Net Framework in the same VS version it works quickly and flawlessly.
Problem description:
Not sure if it is related to VB or is also applicable to C#, but I have the case:
FormIWantToDesign.vb
Friend Class FormIWantToDesign : Inherits ContainerForm
End Class
FormIWantToDesign.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class FormIWantToDesign : Inherits ContainerForm
End Class
ContainerForm.vb
Public Class ContainerForm : Inherits System.Windows.Forms.Form
End Class
ContainerForm.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class ContainerForm
Inherits System.Windows.Forms.Form
'Designer generated code here
End Class
All classes / files are part of the same .Net 5 project. Project compiles, is built, rebuilt, and at runtime everything works.
Expected Behavior:
When I click on FormIWantToDesign.vb
I want the VS to show me a WF designer so I can interact with controls on the form, just as is the case with .Net Framework version of it.
Actual Behavior:
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: 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 FormIWantToDesign --- The base class 'MyProjectNamespace.ContainerForm' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.
Instances of this error (1)
at Microsoft.VisualStudio.WinForms.RemoteClient.Loader.RemoteCodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.WinForms.RemoteClient.Loader.RemoteCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)
Why it says MyProjectNamespace.ContainerForm
cannot be loaded I have no idea. The project has been built, and is the same project as the one that contains the form I try to open in a designer.
Minimal repro: See files samples above.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:24 (17 by maintainers)
Yes, there was an issue about that. @fitdev I am worry if you will have both
RuntimeIdentifier
andPlatforms
- will it work? Also we have https://github.com/dotnet/sdk/issues/1553 😃I believe you can also set up publish profiles which can specify the RuntimeIdentifier to use for publish.