Skip to content

[Regression] Clipboard.GetDataObject().GetImage() returns null on .NET 10 #14423

@TravisEz13

Description

@TravisEz13

Summary

Clipboard.GetDataObject() followed by .GetImage() returns null on .NET 10 Windows Forms. This is a regression — the same code works on .NET 9.

The issue was originally reported as a PowerShell regression: PS 7.5.5 (.NET 9) works, PS 7.6.6 (.NET 10) does not.

Repro steps

First, copy an image to the clipboard (e.g. Ctrl+C selection in MS Paint).

PowerShell repro (original report):

Add-Type -AssemblyName System.Windows.Forms
$dataObject = [Windows.Forms.Clipboard]::GetDataObject()
$dataObject.GetImage()
  • PowerShell 7.5.5 (.NET 9): returns System.Drawing.Bitmap
  • PowerShell 7.6.6 (.NET 10): returns nothing / null

C# repro (net10.0-windows):

using System.Windows.Forms;

class Program
{
    [STAThread]
    static void Main()
    {
        dynamic dataObject = Clipboard.GetDataObject();
        var image = dataObject.GetImage();

        if (image == null)
            Console.WriteLine("GetImage() returned null - no image on clipboard.");
        else
            Console.WriteLine($"Got image: {image.GetType().FullName} ({image.Width}x{image.Height})");
    }
}

With an image on the clipboard, GetImage() returns null on .NET 10.

Expected behavior

GetImage() returns a System.Drawing.Bitmap when an image is on the clipboard.

Actual behavior

GetImage() returns null.

Environment

  • OS: Windows
  • .NET SDK: 10.0.104
  • Target framework: net10.0-windows

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions