iosxcodeautocompletensrangeexception

Xcode 7 beta crash on autocompletion - NSRangeException


I get this crash each time Xcode uses autocompletion.

Steps -

  1. Use any system library - Ex.: UIColor
  2. I type "[UIColor col" and get a list of suggestions (colorWithCGColor - etc)
  3. I hit the delete key to get suggestions for "[UIColor co"
  4. Xcode crashes

I thought this was a specific bug with the Xcode version. But I updated to Xcode beta 5 and still have this issue.

Application Specific Information:
ProductBuildVersion: 7A176x
UNCAUGHT EXCEPTION (NSRangeException): NSMutableRLEArray objectAtIndex:effectiveRange:runIndex:: Out of bounds
UserInfo: (null)
Hints: None
Backtrace:
  0  0x00007fff90401024 __exceptionPreprocess (in CoreFoundation)
  1  0x000000010103bff2 DVTFailureHintExceptionPreprocessor (in DVTFoundation)
  2  0x00007fff8adca76e objc_exception_throw (in libobjc.A.dylib)
  3  0x00007fff90400eed +[NSException raise:format:] (in CoreFoundation)
  4  0x00007fff8995e228 -[NSRLEArray objectAtIndex:effectiveRange:runIndex:] (in Foundation)
  5  0x00007fff8995dfdb -[NSConcreteMutableAttributedString attribute:atIndex:longestEffectiveRange:inRange:] (in Foundation)
  6  0x00000001016953f3 -[DVTTextStorage(DVTTextStorageMRR) attribute:atIndex:longestEffectiveRange:inRange:] (in DVTKit)
  7  0x00007fff92871ef0 -[NSLayoutManager(NSPrivate) _drawBackgroundForGlyphRange:atPoint:] (in UIFoundation)
  8  0x000000010151e1ff -[DVTLayoutManager drawBackgroundForGlyphRange:atPoint:] (in DVTKit)
  9  0x00007fff8f3f46b5 -[NSTextView drawRect:] (in AppKit)
10  0x000000010151cdf8 -[DVTCompletingTextView drawRect:] (in DVTKit)
11  0x000000010151ca98 -[DVTSourceTextView drawRect:] (in DVTKit)
12  0x00007fff8f3ae749 -[NSView(NSInternal) _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:] (in AppKit)
13  0x00007fff8f3ae168 __46-[NSView(NSLayerKitGlue) drawLayer:inContext:]_block_invoke (in AppKit)
14  0x00007fff8f3ade11 -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] (in AppKit)
15  0x00007fff8f3ad493 -[NSView(NSLayerKitGlue) drawLayer:inContext:] (in AppKit)
16  0x00007fff8f62bc42 -[NSTextView drawLayer:inContext:] (in AppKit)
17  0x00007fff958973c7 CABackingStoreUpdate_ (in QuartzCore)
18  0x00007fff958966d7 ___ZN2CA5Layer8display_Ev_block_invoke (in QuartzCore)
19  0x00007fff95896694 x_blame_allocations (in QuartzCore)
20  0x00007fff9588a43c CA::Layer::display_() (in QuartzCore)
21  0x00007fff8f31942b _NSBackingLayerDisplay (in AppKit)
22  0x00007fff8f316026 -[_NSViewBackingLayer display] (in AppKit)
23  0x00007fff8f62bb85 -[_NSTextViewBackingLayer display] (in AppKit)
24  0x00007fff958887fd CA::Layer::display_if_needed(CA::Transaction*) (in QuartzCore)
25  0x00007fff95887e81 CA::Layer::layout_and_display_if_needed(CA::Transaction*) (in QuartzCore)
26  0x00007fff95887612 CA::Context::commit_transaction(CA::Transaction*) (in QuartzCore)
27  0x00007fff958873ae CA::Transaction::commit() (in QuartzCore)
28  0x00007fff8f3869d6 -[NSWindow _setFrameCommon:display:stashSize:] (in AppKit)
29  0x00000001016d91dd -[DVTTextCompletionListWindowController _updateCurrentDisplayState] (in DVTKit)
30  0x00000001016d6084 __82-[DVTTextCompletionListWindowController showWindowForTextFrame:explicitAnimation:]_block_invoke (in DVTKit)
31  0x000000010104e374 __95-[NSObject(DVTObservingConvenience) _dvt_newObserverForKeyPath:options:owner:withHandlerBlock:]_block_invoke (in DVTFoundation)
32  0x000000010104d636 __73-[DVTObservingBlockToken observeValueForKeyPath:ofObject:change:context:]_block_invoke183 (in DVTFoundation)
33  0x0000000100fb9eaf DVTInvokeWithStrongOwnership (in DVTFoundation)
34  0x0000000100e1f49f -[DVTObservingBlockToken observeValueForKeyPath:ofObject:change:context:] (in DVTFoundation)
35  0x00007fff899660f3 NSKeyValueNotifyObserver (in Foundation)
36  0x00007fff89972d68 NSKeyValueDidChange (in Foundation)
37  0x00007fff8992b97d -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] (in Foundation)
38  0x0000000101607a51 -[DVTTextCompletionSession _setFilteringPrefix:forceFilter:] (in DVTKit)
39  0x0000000101549d3e -[DVTTextCompletionSession setCursorLocation:] (in DVTKit)
40  0x00000001014e8101 -[DVTTextCompletionController textViewSelectionChanging] (in DVTKit)
41  0x00000001014e802a -[DVTCompletingTextView setSelectedRanges:affinity:stillSelecting:] (in DVTKit)
42  0x000000010150e817 -[DVTSourceTextView setSelectedRanges:affinity:stillSelecting:] (in DVTKit)
43  0x00000001014e7f1a -[DVTCompletingTextView setSelectedRange:] (in DVTKit)
44  0x000000010150e6a4 -[DVTSourceTextView setSelectedRange:] (in DVTKit)
45  0x00007fff89a7f0a4 _NSSetRangeValueAndNotify (in Foundation)
46  0x00007fff927b93af -[NSLayoutManager textStorage:edited:range:changeInLength:invalidatedRange:] (in UIFoundation)
47  0x0000000101670f20 -[DVTFoldingLayoutManager textStorage:edited:range:changeInLength:invalidatedRange:] (in DVTKit)
48  0x00007fff927db291 -[NSTextStorage _notifyEdited:range:changeInLength:invalidatedRange:] (in UIFoundation)
49  0x00007fff927dad93 -[NSTextStorage processEditing] (in UIFoundation)
50  0x00000001014f2fd3 -[DVTTextStorage processEditing] (in DVTKit)
51  0x00007fff927daa61 -[NSTextStorage endEditing] (in UIFoundation)
52  0x00000001014f2c95 -[DVTTextStorage endEditing] (in DVTKit)
53  0x00000001016316fa -[DVTTextStorage replaceCharactersInRange:withString:evenIfNotEditable:] (in DVTKit)
54  0x00007fff8f65faf1 -[NSTextView(NSPrivate) _userReplaceRange:withString:] (in AppKit)
55  0x00007fff8f65f48b _NSDoUserReplaceForCharRange (in AppKit)
56  0x00007fff8f65f2a6 _NSDoUserDeleteForCharRange (in AppKit)
57  0x00007fff8f6e3c36 -[NSTextView(NSKeyBindingCommands) deleteBackward:] (in AppKit)
58  0x00000001017395f0 -[DVTCompletingTextView deleteBackward:] (in DVTKit)
59  0x00000001015547b2 -[DVTSourceTextView deleteBackward:] (in DVTKit)
60  0x00007fff8f5aeef1 -[NSTextView doCommandBySelector:] (in AppKit)
61  0x0000000101550a10 -[DVTCompletingTextView doCommandBySelector:] (in DVTKit)
62  0x00007fff8f5aee01 -[NSTextInputContext(NSInputContext_WithCompletion) doCommandBySelector:completionHandler:] (in AppKit)
63  0x00007fff8f594c23 -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) interpretEventAsCommand:forClient:] (in AppKit)
64  0x00007fff8fb5b272 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke972 (in AppKit)
65  0x00007fff8f596bff -[NSTextInputContext(NSInputContext_WithCompletion) hasMarkedTextWithCompletionHandler:] (in AppKit)
66  0x00007fff8f5aed03 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke_3 (in AppKit)
67  0x00007fff8f5a7ed8 -[NSTextInputContext tryHandleEvent_HasMarkedText_withDispatchCondition:dispatchWork:continuation:] (in AppKit)
68  0x00007fff8fb5b074 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke960 (in AppKit)
69  0x00007fff8bc1bd4f __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_5 (in HIToolbox)
70  0x00007fff8bc1ac45 ___ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec_block_invoke (in HIToolbox)
71  0x00007fff8f597606 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke174 (in AppKit)
72  0x00007fff8f596bff -[NSTextInputContext(NSInputContext_WithCompletion) hasMarkedTextWithCompletionHandler:] (in AppKit)
73  0x00007fff8f596ba0 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2 (in AppKit)
74  0x00007fff8f596b18 -[NSTextInputContext tryHandleTSMEvent_HasMarkedText_withDispatchCondition:dispatchWork:continuation:] (in AppKit)
75  0x00007fff8f5967d5 -[NSTextInputContext handleTSMEvent:completionHandler:] (in AppKit)
76  0x00007fff8f595b2e _NSTSMEventHandler (in AppKit)
77  0x00007fff8bbb4b6c DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) (in HIToolbox)
78  0x00007fff8bbb3fae SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) (in HIToolbox)
79  0x00007fff8bbb3e22 SendEventToEventTargetWithOptions (in HIToolbox)
80  0x00007fff8bc1826c SendTSMEvent_WithCompletionHandler (in HIToolbox)
81  0x00007fff8bc1876c __SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler_block_invoke (in HIToolbox)
82  0x00007fff8bc185a6 __SendFilterTextEvent_WithCompletionHandler_block_invoke (in HIToolbox)
83  0x00007fff8bc182c0 SendTSMEvent_WithCompletionHandler (in HIToolbox)
84  0x00007fff8bc1808f SendFilterTextEvent_WithCompletionHandler (in HIToolbox)
85  0x00007fff8bc17d51 SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler (in HIToolbox)
86  0x00007fff8bc17ae9 __utDeliverTSMEvent_WithCompletionHandler_block_invoke_2 (in HIToolbox)
87  0x00007fff8bc17988 __utDeliverTSMEvent_WithCompletionHandler_block_invoke (in HIToolbox)
88  0x00007fff8bc177cd TSMKeyEvent_WithCompletionHandler (in HIToolbox)
89  0x00007fff8bc174d0 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_4 (in HIToolbox)
90  0x00007fff8bc17386 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_3 (in HIToolbox)
91  0x00007fff8bc17112 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_2 (in HIToolbox)
92  0x00007fff8bc16f25 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke (in HIToolbox)
93  0x00007fff8bbfb76f TSMProcessRawKeyEventWithOptionsAndCompletionHandler (in HIToolbox)
94  0x00007fff8fb5ae86 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke949 (in AppKit)
95  0x00007fff8f594352 -[NSTextInputContext tryTSMProcessRawKeyEvent:dispatchCondition:setupForDispatch:furtherCondition:dispatchWork:continuation:] (in AppKit)
96  0x00007fff8f594085 -[NSTextInputContext _handleEvent:options:completionHandler:] (in AppKit)
97  0x00007fff8f593b4e -[NSTextInputContext handleEvent:] (in AppKit)
98  0x00007fff8f593a54 -[NSView interpretKeyEvents:] (in AppKit)
99  0x00007fff8f59386a -[NSTextView keyDown:] (in AppKit)
100  0x00007fff8fa830fb -[NSWindow _reallySendEvent:isDelayedEvent:] (in AppKit)
101  0x00007fff8f414c86 -[NSWindow sendEvent:] (in AppKit)
102  0x0000000102479366 -[IDEWorkspaceWindow sendEvent:] (in IDEKit)
103  0x00007fff8f4118b1 -[NSApplication sendEvent:] (in AppKit)
104  0x000000010222fcdf -[IDEApplication sendEvent:] (in IDEKit)
105  0x00007fff8f33ab68 -[NSApplication run] (in AppKit)
106  0x00007fff8f2b7244 NSApplicationMain (in AppKit)
107  0x00007fff8fe485c9 start (in libdyld.dylib)

abort() called

Solution

  • I had the same issue. Xcode 7 crashes all the time in described circumstances. I found that the stefanceriu/SCXcodeMiniMap caused the crash in my case. So I decided to remove it. Just go to ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/ and remove the folder SCXcodeMinimap.xcplugin.