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

WinForms - Add support for OOP Designer (VS2022) #4019

Open
amaitland opened this issue Feb 24, 2022 · 6 comments
Open

WinForms - Add support for OOP Designer (VS2022) #4019

amaitland opened this issue Feb 24, 2022 · 6 comments

Comments

@amaitland
Copy link
Member

The new OOP designer likely requires a new design time class.

Details in https://devblogs.microsoft.com/dotnet/state-of-the-windows-forms-designer-for-net-applications/

https://www.nuget.org/packages/Microsoft.WinForms.Designer.SDK

@amaitland
Copy link
Member Author

Guidance on adding support seems to be limited, have created

@amaitland
Copy link
Member Author

Working branch https://github.com/cefsharp/CefSharp/tree/winforms/oopdesigner

Will wait to hear from the WinForms Team before progressing any further with this.

@goophps
Copy link

goophps commented Feb 25, 2022

thank you

@amaitland
Copy link
Member Author

Example of crash in #4148 (comment) when using designer.

Still no meaningful error message provided by the designer crash.

amaitland added a commit that referenced this issue Mar 13, 2023
- Avoid using using NativeMethodWrapper, hopefully this keeps the designer
  happy, no need to load CefSharp.Core.Runtime.dll

Issue #4019
amaitland added a commit that referenced this issue Mar 14, 2023
- Avoid using using NativeMethodWrapper, hopefully this keeps the designer
  happy, no need to load CefSharp.Core.Runtime.dll

Issue #4019
@amaitland
Copy link
Member Author

Thanks to @davidei1955 for providing a link to a newer designer guide that was published a few months ago.

https://devblogs.microsoft.com/dotnet/custom-controls-for-winforms-out-of-process-designer/

There still isn't a newer SDK available and I was previously very reluctant to provide a dependency on a preview package. After extracting the designer Nupkg I can see it only includes ref assemblies so we should be able to use this as a development dependency (no direct reference will be added to the CefSharp nuget packages).

  • Commit 1dc71ee adds reference to the new designer SDK.
  • Additional refactoring in 1273afc to avoid referencing CefSharp.Core.Runtime.dll. (Change to P/Invoke)

There's some other code that can be converted to P/Invoke that might simplify designer support.

@amaitland
Copy link
Member Author

Anyone wanting to test out the latest changes in relation to the WinForms OOP Designer can use the latest -CI build from https://www.myget.org/F/cefsharp/ (not the -RCI builds, they won't include the changes yet).

You should hopefully be able to add the ChromiumWebBrowser to a form using the designer, it will just say ChromiumWebBrowser if all goes well.

There's still likely issues. I still regularly see crashes with the WinForms OOP Designer with bare WinForms projects (no CefSharp references), so I suspect there are some issues that still need to be worked out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants