Source Editor: interacting with a header file routinely crashes Xcode

Number:rdar://50407410 Date Originated:2019-05-02
Status:Dupe of 48298156 (Closed) Resolved:
Product:Developer Tools Xcode Product Version:10.2
Classification:Crash/Hang/Data Loss Reproducible:Sometimes
When working on a larger Objective-C project, interacting with a header file routinely crashes Xcode if the header contains collapsed documentation comments, due to an index out of bounds exception in `-[NSMutableRLEArray objectAtIndex:effectiveRange::]`.

The interactions include (but are not limited to) scrolling, clicking somewhere, moving the cursor, …

It is hard to overstate how annoying this is, and because I suspect that this is timing dependent, I have not attempted to reproduce this in a sample project.

Steps to Reproduce:
1. in a larger Objective-C project — I guess something like DevToolsCore.framework will do — open a header file that contains multi-line documentation comments
2. select the “Editor > Code Folding > Fold Comment Blocks” menu item or invoke the corresponding shortcut
3. scroll, click, or move the cursor below a folded section a few times

Expected Results:
The source code editor scrolls, responds to the clicks, moves the cursor in a regular fashion

Actual Results:
Way more often than not, Xcode crashes with a stack trace like the one I’ve attached.

First observed on Xcode 10.2 (10E125)



Comment I added after opening 10.2.1 for the first time

This happens very reliably on Version 10.2.1 (10E1001), and I’m including rdar://50407410 on every crash now.

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!