Xcode 8.3b2 (8W120l): playgrounds: creating NSAttributedString with empty image attachment crashes Xcode

Originator:igeek1
Number:rdar://30605012 Date Originated:20-Feb-2017 11:34 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 8.3b2 (8W120l)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
Creating an NSAttributedString with a text attachment containing an empty UIImage causes Xcode to crash.

Steps to Reproduce:
1. Open the attached playground, or paste the following code into an iOS playground:

import UIKit

let image = UIImage()
let textAttachment = NSTextAttachment()
textAttachment.image = image
let attributedStringWithImage = NSAttributedString(attachment: textAttachment)

2. Run the playground.

Expected Results:
Successful run or runtime error message.

Actual Results:
Xcode crashes (log attached).

Regression:
Unknown. Crash reproduces in Xcode 8.1 (11544) and Xcode 8.2.1 (8C1002).

Notes:
Attached playground and crash also uploaded at https://cl.ly/jFCw

Comments

Followup: even if I add a non-empty image via an image literal in the playground, it still crashes when I run it.


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!