Receiving E-Mails in Cocoa app via file-promise drags from does not work reliably.

Number:rdar://36400859 Date Originated:January 10 2018, 9:49 AM
Status:Open Resolved:
Product:macOS / AppKit Product Version:10.13.2
Classification:Other Reproducible:Always
Receiving E-Mails in Cocoa app via file-promise drags from does not work reliably.

Steps to reproduce:
- Download
- Build and run "MailAppFilePromiseBug" with Xcode 9.2 under macOS 10.13.2 or later
- Onto the upcoming window, drag & drop a single e-mail from
- Check the console log

Expected result:
The log should contain output like this:
2018-01-10 09:30:33.004117+0100 MailAppFilePromiseBug[5304:2763698] promisesDirectory: /var/folders/sh/bdrggr0j4t98t1d9tbng183h0000gn/T/89E54AF9-CCE5-4C11-B0C4-203289F6678D
2018-01-10 09:30:33.005117+0100 MailAppFilePromiseBug[5304:2763698] Promised file type:
2018-01-10 09:30:33.008931+0100 MailAppFilePromiseBug[5304:2763698] Promised file URL: /var/folders/sh/bdrggr0j4t98t1d9tbng183h0000gn/T/89E54AF9-CCE5-4C11-B0C4-203289F6678D
2018-01-10 09:30:35.009623+0100 MailAppFilePromiseBug[5304:2763698] Created files: ("My test email.eml")

Actual result:
The log contains output like this:
2018-01-10 09:29:09.004117+0100 MailAppFilePromiseBug[5304:2763698] promisesDirectory: /var/folders/sh/bdrggr0j4t98t1d9tbng183h0000gn/T/89E54AF9-CCE5-4C11-B0C4-203289F6678D
2018-01-10 09:29:09.078981+0100 MailAppFilePromiseBug[5252:2755928] Promised file type:
2018-01-10 09:29:09.083108+0100 MailAppFilePromiseBug[5252:2755928] Promised file URL: (null)
2018-01-10 09:29:11.083490+0100 MailAppFilePromiseBug[5252:2755928] Created files: ()

Further information:
- The problem does not occur, when dragging photos from onto the test window.
- When uncommenting line 67 in ContentView.m, the problem does not occur after starting the test app for
  the second time.
- When dragging multiple e-mails, even violates the file-promise handshake described in Pateboard.h by not providing a file type in kPasteboardTypeFilePromiseContent. To my mind, should create a pasteboard item for every dragged e-mail.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!