Skip to content

Clipboard.ContainsText behaves differently in .NET8 .NET9 .NET10 #14172

@a-solovyev-dx

Description

@a-solovyev-dx

.NET version

net8.0-windows
net9.0-windows
net10.0-windows

Did it work in .NET Framework?

Yes

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

net8.0-windows

Issue description

The following code displays "Nothing" in .net9. Both .net8 and .net10 display "Something"

DataObject data = new DataObject();
data.SetData("Something");
Clipboard.SetDataObject(data);

if(Clipboard.ContainsText())
    MessageBox.Show(this, Clipboard.GetText());
else
    MessageBox.Show(this, "Nothing");

.net8

Image

.net9

Image

.net10

Image

Steps to reproduce

WinFormsApp2.zip
You may use this project as a reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-ClipboardIssues related to ClipboarduntriagedThe team needs to look at this issue in the next triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions