The biggest cause of this that I've found is the coder expecting there to be an image on the clipboard only to find, with further digging, a filepath instead.
You can build a tool really quick to see what data formats are on the clipboard. Just create a Windows Forms app with a Button and a ListBox on it and drop the following code in the Button Click event handler:
IDataObject dataObject = Clipboard.GetDataObject;
if (dataObject != null) {
ListBox1.Items.Clear();
ListBox1.Items.AddRange(dataObject.GetFormats(true));
}
The
true
in the
GetFormats()
call will list not only the data formats that are available for the object on the clipboard but also the formats that the data can be automatically converted to.
For an image, you'd normally look for
DeviceIndependantBitmap
.