Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding what causes Xcode 8.2 to crash while indexing an old project

I have an old objective-c project I haven't touch since 2013.

I have upgraded Xcode to the latest 8.2 version and reopened the project (with lots of warning).

By opening the project the indexing starts almost immediately, and then Xcode crashes after few seconds. This is the relevant (relevant to me) portion of the stack trace.

Crashed Thread:        18

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
ProductBuildVersion: 8C38
UNCAUGHT EXCEPTION (NSInvalidArgumentException): *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
UserInfo: (null)
Hints: None
Backtrace:
  0   __exceptionPreprocess (in CoreFoundation)
  1   DVTFailureHintExceptionPreprocessor (in DVTFoundation)
  2   objc_exception_throw (in libobjc.A.dylib)
  3   -[__NSArrayM insertObject:atIndex:] (in CoreFoundation)
  4   -[XCCompilerSpecificationIBStoryboardLinker _outputNodesForInputNodes:withMacroExpansionScope:] (in DevToolsCore)
  5   -[XCCompilerSpecificationIBStoryboardLinker doSpecialDependencySetupForCommand:withInputNodes:withMacroExpansionScope:] (in DevToolsCore)
  6   -[XCCommandLineToolSpecification createCommandsforInputs:withMacroExpansionScope:] (in DevToolsCore)
  7   -[PBXTargetBuildContext invokeTask:forInputs:withMacroExpansionScope:optionTable:] (in DevToolsCore)
  8   -[XCDependencyGraphCreationContext invokeTask:forInputs:withMacroExpansionScope:optionTable:] (in DevToolsCore)
  9   -[XCCompilerSpecification computeDependenciesForInputNodes:ofType:variant:architecture:outputDirectory:withMacroExpansionScope:] (in DevToolsCore)
 10   -[XCBuildRuleDGSnapshot(DependencyGraphCreation) computeDependenciesForBuildFileReference:withOutputDirectory:parameterMacros:withMacroExpansionScope:] (in DevToolsCore)
 11   -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) _computeDependenciesForBuildFileReference:usingBuildRule:withMacroExpansionScope:processedPaths:] (in DevToolsCore)
 12   -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForBuildFileReference:usingBuildRule:withMacroExpansionScope:] (in DevToolsCore)
 13   -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForBuildFileReference:withMacroExpansionScope:] (in DevToolsCore)
 14   -[XCBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForAllBuildFileReferencesWithMacroExpansionScope:] (in DevToolsCore)
 15   -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForAllBuildFileReferencesWithMacroExpansionScope:] (in DevToolsCore)
 16   -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesWithMacroExpansionScope:] (in DevToolsCore)
 17   -[XCProductTypeSpecification computeDependenciesWithMacroExpansionScope:] (in DevToolsCore)
 18   -[XCNativeTargetDGSnapshot(DependencyGraphCreation) computeDependenciesWithMacroExpansionScope:] (in DevToolsCore)
 19   -[PBXTargetBuildContext createDependencyGraphWithTargetDGSnapshot:] (in DevToolsCore)
 20   -[PBXTargetBuildContext(DependencyGraphEvents) dg_setTargetSnapshot:] (in DevToolsCore)
 21   -[PBXTargetBuildContext(DependencyGraphEvents) processDependencyGraphEvents] (in DevToolsCore)
 22   -[XCBlockQueue _processNextBlockInThreadSlotNumber:] (in DevToolsCore)
 23   -[XCBlockQueue _processBlocksInThreadSlotNumber:] (in DevToolsCore)
 24   __NSThread__start__ (in Foundation)
 25   _pthread_body (in libsystem_pthread.dylib)
 26   _pthread_body (in libsystem_pthread.dylib)
 27   thread_start (in libsystem_pthread.dylib)

abort() called

Application Specific Signatures:
NSInvalidArgumentException

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fffbc7ac0db __exceptionPreprocess + 171
1   DVTFoundation                       0x00000001067b8772 DVTFailureHintExceptionPreprocessor + 194
2   libobjc.A.dylib                     0x00007fffd143ea2a objc_exception_throw + 48
3   CoreFoundation                      0x00007fffbc6c796d -[__NSArrayM insertObject:atIndex:] + 1389
4   DevToolsCore                        0x00000001116337af -[XCCompilerSpecificationIBStoryboardLinker _outputNodesForInputNodes:withMacroExpansionScope:] + 662
5   DevToolsCore                        0x0000000111634054 -[XCCompilerSpecificationIBStoryboardLinker doSpecialDependencySetupForCommand:withInputNodes:withMacroExpansionScope:] + 378
6   DevToolsCore                        0x00000001114c24ab -[XCCommandLineToolSpecification createCommandsforInputs:withMacroExpansionScope:] + 6079
7   DevToolsCore                        0x000000011144e0f0 -[PBXTargetBuildContext invokeTask:forInputs:withMacroExpansionScope:optionTable:] + 1890
8   DevToolsCore                        0x000000011156cb26 -[XCDependencyGraphCreationContext invokeTask:forInputs:withMacroExpansionScope:optionTable:] + 109
9   DevToolsCore                        0x00000001114cbc2e -[XCCompilerSpecification computeDependenciesForInputNodes:ofType:variant:architecture:outputDirectory:withMacroExpansionScope:] + 1767
10  DevToolsCore                        0x00000001115b4f53 -[XCBuildRuleDGSnapshot(DependencyGraphCreation) computeDependenciesForBuildFileReference:withOutputDirectory:parameterMacros:withMacroExpansionScope:] + 3447
11  DevToolsCore                        0x00000001115a5617 -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) _computeDependenciesForBuildFileReference:usingBuildRule:withMacroExpansionScope:processedPaths:] + 3319
12  DevToolsCore                        0x00000001115a7f43 -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForBuildFileReference:usingBuildRule:withMacroExpansionScope:] + 137
13  DevToolsCore                        0x00000001115a840a -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForBuildFileReference:withMacroExpansionScope:] + 1179
14  DevToolsCore                        0x0000000111592bde -[XCBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForAllBuildFileReferencesWithMacroExpansionScope:] + 2581
15  DevToolsCore                        0x00000001115ab2b3 -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesForAllBuildFileReferencesWithMacroExpansionScope:] + 65
16  DevToolsCore                        0x00000001115ad676 -[XCSourcesBuildPhaseDGSnapshot(DependencyGraphCreation) computeDependenciesWithMacroExpansionScope:] + 9116
17  DevToolsCore                        0x00000001114d1359 -[XCProductTypeSpecification computeDependenciesWithMacroExpansionScope:] + 2113
18  DevToolsCore                        0x000000011158aa09 -[XCNativeTargetDGSnapshot(DependencyGraphCreation) computeDependenciesWithMacroExpansionScope:] + 4140
19  DevToolsCore                        0x000000011144429a -[PBXTargetBuildContext createDependencyGraphWithTargetDGSnapshot:] + 4474
20  DevToolsCore                        0x0000000111460cb3 -[PBXTargetBuildContext(DependencyGraphEvents) dg_setTargetSnapshot:] + 522
21  DevToolsCore                        0x0000000111460336 -[PBXTargetBuildContext(DependencyGraphEvents) processDependencyGraphEvents] + 290
22  DevToolsCore                        0x00000001114c764e -[XCBlockQueue _processNextBlockInThreadSlotNumber:] + 460
23  DevToolsCore                        0x00000001114c79ea -[XCBlockQueue _processBlocksInThreadSlotNumber:] + 300
24  Foundation                          0x00007fffbe165c6d __NSThread__start__ + 1243
25  libsystem_pthread.dylib             0x00007fffd1f37aab _pthread_body + 180
26  libsystem_pthread.dylib             0x00007fffd1f379f7 _pthread_body + 0
27  libsystem_pthread.dylib             0x00007fffd1f371fd thread_start + 13

and this is the thread that crashed, with little information given.

Thread 18 Crashed:
0   libsystem_kernel.dylib          0x00007fffd1e4edd6 __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fffd1f3a787 pthread_kill + 90
2   libsystem_c.dylib               0x00007fffd1db4420 abort + 129
3   com.apple.dt.IDEKit             0x0000000107e4562b +[IDEAssertionHandler _handleAssertionWithLogString:assertionSignature:assertionReason:extraBacktrace:] + 1466
4   com.apple.dt.IDEKit             0x0000000107e46bf7 -[IDEAssertionHandler handleUncaughtException:] + 1073
5   com.apple.dt.IDEKit             0x0000000107e46cc3 IDEHandleUncaughtException + 94
6   com.apple.CoreFoundation        0x00007fffbc829d89 __handleUncaughtException + 745
7   libobjc.A.dylib                 0x00007fffd1440b85 _objc_terminate() + 94
8   libc++abi.dylib                 0x00007fffd0933d69 std::__terminate(void (*)()) + 8
9   libc++abi.dylib                 0x00007fffd09339f2 __cxa_rethrow + 99
10  libobjc.A.dylib                 0x00007fffd143ef07 objc_exception_rethrow + 40
11  com.apple.Xcode.DevToolsCore    0x00000001114c78a9 -[XCBlockQueue _processNextBlockInThreadSlotNumber:] + 1063
12  com.apple.Xcode.DevToolsCore    0x00000001114c79ea -[XCBlockQueue _processBlocksInThreadSlotNumber:] + 300
13  com.apple.Foundation            0x00007fffbe165c6d __NSThread__start__ + 1243
14  libsystem_pthread.dylib         0x00007fffd1f37aab _pthread_body + 180
15  libsystem_pthread.dylib         0x00007fffd1f379f7 _pthread_start + 286
16  libsystem_pthread.dylib         0x00007fffd1f371fd thread_start + 13

These are the steps I have taken to solve the issue:

Disable automatic indexing.

defaults write com.apple.dt.XCode IDEIndexDisable 1

I have tried many things, including create the project again from scratch from git, or just clean derived data folder.

Then I spot this in the stack trace

XCCompilerSpecificationIBStoryboardLinker

so, in a desperate move, I have deleted the storyboard and added again with "add files". I have reenabled indexing and everything starts working again, no more crash.

The question is: what's wrong with my storyboard ? What is causing XCode to crash at indexing ?

like image 637
Leonardo Avatar asked Oct 30 '22 15:10

Leonardo


2 Answers

From the threads below:

Xcode 6.1 crash on "Edit scheme"

https://forums.developer.apple.com/thread/19859

Try following may it will help:

1.

Try to switch your Mac OS language settings to English (System Preferences -> Language & Region), add English in Preferred Languages and set it to Primary.

2.

use command:

defaults delete com.apple.dt.Xcode
like image 113
Ronak Chaniyara Avatar answered Nov 15 '22 06:11

Ronak Chaniyara


Right click on the file .xcworkspace > Show Package Contents

Delete the xcuserdata folder

And now Xcode will open the project workspace just fine.

like image 25
Elangovan Ayyasamy Avatar answered Nov 15 '22 05:11

Elangovan Ayyasamy