dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.4k stars 976 forks source link

Visual Studio Crashes on Drag-and-Drop from Custom Dialog to Container in WinForms .NET Core Application #12326

Open Sekar47 opened 1 week ago

Sekar47 commented 1 week ago

Environment

Edition - Windows 11 Enterprise Version - 23H2 OS build - 22631.3737 Visual Studio version - 17.10.4

.NET version

.NET Core 60 ,80

Did this work in a previous version of Visual Studio and/or previous .NET release?

it doesn't work on previous NetCore versions.

Issue description

I'm experiencing a crash in Visual Studio when attempting to drag a control type from a custom dialog to a container control in a WinForms .NET Core application. The drag-and-drop functionality is implemented, but Visual Studio becomes unresponsive and eventually crashes.Custom-Sample.zip

Steps to reproduce

1.Extract and Open the Attached Sample: Download and extract the provided sample project. 2.Open Form1 in Design View: Launch the project and open Form1 in the Visual Studio Designer. 3.Access the Smart Tag: Click on the smart tag option of the custom container control. 4.Open the Add Control Dialog: Click on the "Add Control" option; a dialog box should open displaying four control types. 5.Attempt to Drag and Drop: Try to drag any one of the controls from the dialog and drop it into the container on the Form1 window. 6.Observe the Crash: Note that Visual Studio crashes during the drag-and-drop operation.

Diagnostics

No response

Tanya-Solyanik commented 18 hours ago

Sample project references the designer SDK

Tanya-Solyanik commented 18 hours ago

The AddControl designer action attempts to open a dialog in the DesignToolsServer process. Winforms Designer does not support direct UI interactions from the server process. All UI should be opened in the VisualStudio process. https://devblogs.microsoft.com/dotnet/custom-controls-for-winforms-out-of-process-designer/