question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:24 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
kirsan31commented, Dec 8, 2020

The RuntimeIdentifier may be used beyond publishing, maybe the VS designer is running 64 bit and setting the RuntimeIdentifier conflicts? Just a random guess.

Yes, there was an issue about that. @fitdev I am worry if you will have both RuntimeIdentifier and Platforms - will it work? Also we have https://github.com/dotnet/sdk/issues/1553 😃

1reaction
dsplaistedcommented, Dec 13, 2020

I believe you can also set up publish profiles which can specify the RuntimeIdentifier to use for publish.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Display Inherited Form in Form Designer When ...
It seems this a Visual Studio 2022 bug that affects only inherited forms whenever their base classes are stored on x86 dll assemblies....
Read more >
Cannot Display Inherited Form in Form Designer When ...
The Form Designer requires a compiled assembly in order to display an inherited form. If the base form class is contained within an...
Read more >
[WinForms] Designer not load Forms with visual ...
When you try to open inherited form in designer, designer will not open with the error: The designer could not be shown for...
Read more >
[Solved] C#, Editing inherited Form in Designer
I inherited a form from a base class but designer shows following error: Failed to load designer. Check the source code for syntax...
Read more >
x64: Form inheriting from another form cannot be designed
The designer inspected the following classes in the file: DerivedForm --- The base class 'MultipleFormInheritence.BaseForm' could not be loaded.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found