You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clipboard.ContainsText behaves differently in .NET8 .NET9 .NET10 #14172
area-ClipboardIssues related to Clipboardwaiting-on-teamThis work item needs to be discussed with team or is waiting on team action in order to proceed
@a-solovyev-dx, thanks raised the issue, the issue have been reported than before, and have been resolved, please see details in #12665.
And the fix should also be port in .NET 9.0 but seems there have some wrong things appear, will investigate it,
@a-solovyev-dx is this blocking your application in some way? .NET 9 will be supported for most of this year, but you're better off generally going with the LTS of .NET 10 which will last until Nov 2028. If you're blocked and can't move to 10, we can consider servicing.
return ContainsData(ConvertToDataFormats(format), autoConvert: true);
)
resolved this regression in .NET 10.0, restoring the behavior to match .NET 8.0. @merriemcgaw@KlausLoeffelmann — should we consider backporting this fix to .NET 9.0 as well?
@a-solovyev-dx is this blocking your application in some way? .NET 9 will be supported for most of this year, but you're better off generally going with the LTS of .NET 10 which will last until Nov 2028. If you're blocked and can't move to 10, we can consider servicing.
We are not building end-user applications, but rather provide components for our clients to build upon. With this in mind we cannot guarantee they all move to .NET 10. In fact, this issue was discovered by one of our clients and we had to think about some workaround for them.
As a workaround:
Users can change the way the clipboard is set to SetText, which will store the text in the correct text format (UnicodeText). Clipboard.SetText("Something");
If a DataObject must be used, the text can be explicitly placed into the DataObject in UnicodeText format. data.SetData(DataFormats.UnicodeText, "Something");
Thank you for the workaround. However, in our case, the logic of the clipboard is hidden from the user sometimes (i.e. built-in context menus, commands, etc) and in some cases we cannot even guarantee that there will be text and not something else due to the nature of the data.
area-ClipboardIssues related to Clipboardwaiting-on-teamThis work item needs to be discussed with team or is waiting on team action in order to proceed
Activity
Zheng-Li01 commentedon Dec 29, 2025
@a-solovyev-dx, thanks raised the issue, the issue have been reported than before, and have been resolved, please see details in #12665.
And the fix should also be port in .NET 9.0 but seems there have some wrong things appear, will investigate it,
Zheng-Li01 commentedon Jan 4, 2026
Seems related the issue #12789
LeafShi1 commentedon Jan 4, 2026
The behavioral change in .NET 9.0 originated from PR #10651.
PR #12833 (which updated
ContainsTextto passautoConvert: true:winforms/src/System.Windows.Forms/System/Windows/Forms/OLE/Clipboard.cs
Line 127 in 05b7c2e
resolved this regression in .NET 10.0, restoring the behavior to match .NET 8.0.
@merriemcgaw @KlausLoeffelmann — should we consider backporting this fix to .NET 9.0 as well?
merriemcgaw commentedon Jan 6, 2026
@a-solovyev-dx is this blocking your application in some way? .NET 9 will be supported for most of this year, but you're better off generally going with the LTS of .NET 10 which will last until Nov 2028. If you're blocked and can't move to 10, we can consider servicing.
KlausLoeffelmann commentedon Jan 7, 2026
What @merriemcgaw said.
a-solovyev-dx commentedon Jan 8, 2026
We are not building end-user applications, but rather provide components for our clients to build upon. With this in mind we cannot guarantee they all move to .NET 10. In fact, this issue was discovered by one of our clients and we had to think about some workaround for them.
LeafShi1 commentedon Jan 9, 2026
As a workaround:
Users can change the way the clipboard is set to
SetText, which will store the text in the correct text format (UnicodeText).Clipboard.SetText("Something");If a
DataObjectmust be used, the text can be explicitly placed into theDataObjectin UnicodeText format.data.SetData(DataFormats.UnicodeText, "Something");a-solovyev-dx commentedon Jan 9, 2026
Thank you for the workaround. However, in our case, the logic of the clipboard is hidden from the user sometimes (i.e. built-in context menus, commands, etc) and in some cases we cannot even guarantee that there will be text and not something else due to the nature of the data.