Invoking Action Extensions in NSTextView on a non-NSFileWrapper based NSAttributedString crashes the extension with an unhelpful error message

Originator:joshparnham
Number:rdar://20333977 Date Originated:28-Mar-2015
Status:Open Resolved:
Product:OS X SDK Product Version:OS X 10.10.2
Classification:Important Reproducible:
 
Summary:
When an image is inserted into a NSTextView by using a NSTextAttachmentCell in a NSAttributedString, invoking an Action Extension on it will cause the Extension to crash with a cryptic message that is unhelpful to debugging.

There also doesn't appear to be any useful documentation on the use of Action Extensions in OS X (I had to attain my knowledge from the WWDC 2014 session 217 video).

The attached example project demonstrates this issue (note that invoking the extension using the NSTextAttachmentCell method illustrated above also is quite difficult, as one must move their mouse around and select the image before the Extension drop-down appears.

Steps to Reproduce:
1. Create an Xcode project
2. Init a NSTextAttachmentCell with a NSImage
3. Init a NSTextAttachment with the NSTextAttachmentCell
4. Init a NSAttributedString with the NSTextAttachment
5. Insert the NSAttributedString into the NSTextView
6. Run the app
7. Invoke an Action Extension on the image in the NSTextView

Expected Results:
Either:
- The Action Extension is successfully invoked
or:
- The extension crashes with an error message that indicates why the image was unable to be accessed

Actual Results:
The Extension crashes with "error with remoteObjectProxyWithErrorHandler: Error Domain=NSCocoaErrorDomain Code=4097 "Couldn’t communicate with a helper application." (connection from pid 37189) UserInfo=0x608000277a00 {NSDebugDescription=connection from pid 37189}"

and the Application Specific Information in the Extension crash report is:
Crashing on exception: NSDictionaryOfVariableBindings failed because either one of the values is nil, or there's something wrong with the way the macro is being invoked.  Cannot assign value nil for key "contentView". Keys:(
    contentView
)

None of which are very helpful in debugging.

Version:
OS X 10.10.2 (14C1514)
Xcode 6.2 (6C131e)

Notes:


Configuration:


Attachments:
'TextViewExtensionCrash.zip' was successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com 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!