Skip to content

[Bug]: Cannot add child controls to a KryptonGroupBox in the VS designer #3287

@andyh444

Description

@andyh444

Summary

Cannot add child controls to a KryptonGroupBox in the VS designer

Description

If I attempt to add any control to a KryptonGroupBox in the visual studio (2022 or 2026) designer, I get an exception, but only if it's a .net 8 or .net 10 project (probably other .net core versions too). This doesn't happen if it's a .net framework project.

Steps to Reproduce

Create a new .net 8 or .net 10 winforms project, and add the latest Krypton.Toolkit nuget package (100.26.1.19). Change Form1 to a KryptonForm, and then open it in the visual studio designer. Click and drag a KryptonGroupBox into the form, and then attempt to click and drag any other control (e.g. KryptonLabel) into the group box.

Expected Behavior

The control should just get added to the KryptonGroupBox, like it would if it were a vanilla WinForms GroupBox

Actual Behavior

Instead, visual studio gives me an exception:

Failed to create component 'KryptonLabel'. The error message follows:

'Microsoft.DotNet.DesignTools.Client.DesignToolsServerException: ReadOnly controls collection

at Microsoft.DotNet.DesignTools.Client.DesignToolsClient.d__49`1.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()

at Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()

at Microsoft.DotNet.DesignTools.Protocol.Endpoints.DesignToolsEndpoints.DesignerHostsImpl.CreateComponent(SessionId sessionId, TypeIdentity type, String name, NameValuePairs defaultValues)

at Microsoft.WinForms.DesignTools.Client.Toolbox.WinFormsToolboxItem.CreateComponentsCore(IDesignerHost host, IDictionary defaultValues)

at System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost host, IDictionary defaultValues)

at Microsoft.DotNet.DesignTools.Client.Designers.ComponentProxyDesigner.CreateTool(ToolboxItem tool, Nullable1 location, Nullable1 size, ObjectProxy toolboxSnapArgs)'

Operating System

Windows 11

OS Version

10.0.22631

Framework/.NET Version

Happens in both .net 8 and .net 10, but not .net framework

Toolkit Version

Happens in all versions of krypton toolkit with support for .net core and .net 5+, up to and including 100.26.1.19

Additional Information

No response

Areas Affected

Toolkit

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolkitAll issues related to the toolkit components.area:winforms-designer-sdkAll items related to the WinForms Designer Extensibility SDK.known bugThis is a known bug/issue.🪲 bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions