This is looking like a framework problem. I debugged IDataObject.GetData; in System.Windows.Forms.DataObject.OleConvertor.GetDataFromOleOther, on line 1508 of DataObject.cs, the COM interop call "innerData.GetData(ref formatetc, out medium);" throws an OutOfMemoryException. Native apps, including vb6 don't have any issues.
Here is a test app that takes paint.net out of the equation
class Program
{
[sTAThread]
static void Main(string[] args)
{
do
Console.WriteLine(Paste());
while (Console.ReadKey(true).Key != ConsoleKey.Escape);
}
private static string Paste()
{
IDataObject data = Clipboard.GetDataObject();
if (data == null) return "null GetDataObject";
if (!data.GetDataPresent(DataFormats.Bitmap, true)) return "not GetDataPresent";
Image img = data.GetData(DataFormats.Bitmap, true) as Image;
if (img == null) return "null GetData";
return "OK";
}
}
I found that the very first call to Paste() after copy is done in VMware, succeeds, but all subsequent ones, fail ("null GetData").
In paint.net, the same thing happens, I can actually get it to paste the first time after copy, using Edit->Paste. It turns out that "Edit->Paste Into New Image" calls GetData twice, once in PasteInToNewImageAction, which is discarded, and again in PasteAction. The second call always fails and so "Paste Into New Image" never works. So I think there is a workaround, pending the resolution of the larger problem. Can you refactor PasteInToNewImageAction and PasteAction so that GetData only gets called once between them?
Since you're in Microsoft, perhaps you get the framework team to look at this, someone surely has VMware.