Skip to content

ColorDialog fails to reset Custom Colors collection after clicking Cancel #13067

Closed
@Syareel-Sukeri

Description

@Syareel-Sukeri

.NET version

.NET 10.0 SDK build: 10.0.100-preview.3.25153.9

Did it work in .NET Framework?

Yes

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No, still repro in .NET 8.0/9.0

Issue description

Current Behavior (.NET Core):
The Custom Colors collection is not cleared after clicking Cancel.

ColorDialogCore.mp4

Expected Behavior (.NET Framework):
The Custom Colors collection reset after clicking Cancel.

ColorDialogFx.mp4

Steps to reproduce

  1. Create a WinForms project in .NET Core with Button and ColorDialog added.
  2. In the button’s click event, show the ColorDialog:
    private void button1_Click(object sender, EventArgs e)
    {
      colorDialog1.ShowDialog();
    }
  1. Run the application and click the button to open the ColorDialog.
  2. Add a custom color and click Cancel.
  3. Click the button again to reopen the ColorDialog.

or using following sample app

ColorDialogCC.zip

More Info

  1. The issue cannot be reproduced when a new ColorDialog is created inside the method each time. In this case, the Custom Colors reset correctly after reopening the dialog in both .NET Core and .NET Framework.
private void button1_Click(object sender, EventArgs e)
{
    using (ColorDialog colorDialog = new ColorDialog())
    {
        colorDialog.ShowDialog();
    }
}

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions