Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherited forms don't work in the designer for .NET Core #3338

Closed
ekolis opened this issue May 24, 2020 · 19 comments
Closed

Inherited forms don't work in the designer for .NET Core #3338

ekolis opened this issue May 24, 2020 · 19 comments
Assignees
Labels
area-VSDesigner Windows Forms out-of-proc designer related issues
Milestone

Comments

@ekolis
Copy link

ekolis commented May 24, 2020

  • .NET Core Version:
    3.1

  • Have you experienced this same bug with .NET Framework?:
    No

Problem description:

  1. Create a .NET Core WinForms app.
  2. Create a form.
  3. Create a second form.
  4. Edit the second form's code behind to make it inherit from the first form.
  5. Open the visual designer for the second form.

The designer will then crash with this error:

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 Form2 --- The base class 'BrokenFormsInheritance.Form1' could not be loaded. Ensure the assembly has been referenced and that all projects have been built. | 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 Form2 --- The base class 'BrokenFormsInheritance.Form1' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.
-- | --
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 Form2 --- The base class 'BrokenFormsInheritance.Form1' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.

  1. Build the project as the error indicates.

The error will remain regardless of if I build the project.

Expected behavior:

The designer opens.

Minimal repro:

see attached

BrokenFormsInheritance.zip

@kirsan31
Copy link
Contributor

@RussKie RussKie added the area-VSDesigner Windows Forms out-of-proc designer related issues label May 28, 2020
@merriemcgaw
Copy link
Member

Yep, we've got an internal item on our backlog for this issue.'

@merriemcgaw merriemcgaw self-assigned this May 28, 2020
@ekolis
Copy link
Author

ekolis commented May 28, 2020

Great, thanks!

@merriemcgaw merriemcgaw added this to the VS release milestone Jun 4, 2020
@kirsan31
Copy link
Contributor

Any eta? Will this and all .net controls be ready to 5.0?

@merriemcgaw
Copy link
Member

This is a designer specific feature, and we've got it on the agenda. We likely won't have it for 16.8 but hopefully in the next VS release. Which control(s) do we not have runtime support for? We've still got a couple of controls to get designer support for as we continue to implement features, and there are a handful of designers that are very specific to our controls and we've gotten most of these into our designer or will have shortly.

@kirsan31
Copy link
Contributor

Which control(s) do we not have runtime support for?

DataGridView 😋

@merriemcgaw
Copy link
Member

@kirsan31 we've ported the DataGridView control to Core a long time ago. @RussKie is working on #3875 as we speak. I'm hopeful we can get it approved for 5.0. Are you facing other issues?

cc: @dreddy-work

@kirsan31
Copy link
Contributor

I am sorry for misleading, by all .net controls be ready to 5.0 I mean new designer will be handle them.

@dreddy-work
Copy link
Member

@kirsan31 , we did port large portion of the designers for those controls as well. There are very few designers that were low in our priority list based on their usage and are on our list to port as we progress. If you see a specific control that its designer is not working or not available, please let us know.

@kirsan31
Copy link
Contributor

kirsan31 commented Sep 16, 2020

@dreddy-work as I mentioned above - DataGridView. It's not usable in designer because of not working styles editors (all of them). Some related issue. But for me behavior is not changed from 16.7 Pr. 5 - All style dialogs opening correctly, but produce no code - no changes.
Quick look at ListView bring that item editor not showing color selection dialog. Changing color by double click - immediately apply it to the code regardless if I will press cancel next...

V.S. 16.8 pr. 3.

P.s. I think this is a bit off topic here - do we need create new issue or something?

@RussKie
Copy link
Member

RussKie commented Sep 16, 2020

do we need create new issue or something?

Please raise these issues via the VS Feedback tool, as it captures necessary telemetry such as versions of components, etc.

@kirsan31
Copy link
Contributor

kirsan31 commented Sep 16, 2020

@RussKie Done: Issue1, Issue2.

@kirsan31
Copy link
Contributor

kirsan31 commented Oct 5, 2020

@Shyam-Gupta

Regarding inherited Forms: They should work after the application is built. If not then let me know and we can discuss it on the other issue.

I've modified original repro a bit: DesignerInheritence.zip
V.S. 16.8 P. 3.2:

vsi

System.InvalidOperationException: 'Site' must not be null in order to access a required service.
   at WinFormsSurface.Designers.ComponentDesigner.GetRequiredService[T]()
   at WinFormsSurface.Designers.ControlDesigner.SetUnhandledException(Control owner, Exception exception)
   at WinFormsSurface.Designers.ControlDesigner.DesignerWindowTarget.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

@kirsan31
Copy link
Contributor

V.S. 16.8 P. 4 - same behavior.

@dreddy-work
Copy link
Member

dreddy-work commented Oct 19, 2020

Inheritance in general was working fine when you build and open the designer. In this sample app, issue was because of a bug in the DataGridView designer code. This issue fixed today in the designer repo by Dustin and will be available in the VS 16.9 preview2.

@dreddy-work
Copy link
Member

Also, original issue was about the inheritance, I think we can close this issue. Let me know if you disagree @kirsan31.

@kirsan31
Copy link
Contributor

@dreddy-work I've checked our big project and with visual inheritance seems all is ok...
But there were other problems about the new designer. Where to report them? V.S. report tool?

@dreddy-work
Copy link
Member

@dreddy-work I've checked our big project and with visual inheritance seems all is ok...
But there were other problems about the new designer. Where to report them? V.S. report tool?

You can always report them via VS feedback tool. And that is preferred way for now for designer related issues. But if you end up reporting here, we might transfer the issue t designer repo ( which is not public) and it would be hard to track the status for you.

@dreddy-work
Copy link
Member

As you opened #4139 , closing this issue.

@ghost ghost locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-VSDesigner Windows Forms out-of-proc designer related issues
Projects
None yet
Development

No branches or pull requests

5 participants