Crashing only in Xcode 13.0 (EXC_BAD_INSTRUCTION)

Working in latest version of Xcode 12.

When opening a SwiftUI view containing a Core Data list, a crash occurs and execution stops at the first line of the AppDelegate. There is no backtrace info in the console and from what I can see in the backtrace (attached crash.txt), and by stepping through each frame in Xcode, I don't see any code in my app.

Is this a bug? Advice on how to fix? In Xcode 13.0 (only), I cannot view any List. The same code runs as expected in Xcode 12.5

David

(lldb) bt all
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
	frame #0: 0x00007fff5b5e19f3 SwiftUI`SwiftUI.SystemListDataSource.contextForItem(index: (Swift.Int, Swift.Int)) -> SwiftUI._RowVisitationContext<SwiftUI.SystemListDataSource<τ_0_0>> + 304
	frame #1: 0x00007fff5b5e1a5d SwiftUI`protocol witness for SwiftUI.ListCoreDataSource.contextForItem(index: (τ_0_0.SectionIDs.Index, τ_0_0.RowIDs.Index)) -> SwiftUI._RowVisitationContext<τ_0_0> in conformance SwiftUI.SystemListDataSource<τ_0_0> : SwiftUI.ListCoreDataSource in SwiftUI + 15
	frame #2: 0x00007fff5b783db6 SwiftUI`SwiftUI.ShadowListDataSource.contextForItem(index: (τ_0_0.SectionIDs.Index, τ_0_0.RowIDs.Index)) -> SwiftUI._RowVisitationContext<SwiftUI.ShadowListDataSource<τ_0_0>> + 752
	frame #3: 0x00007fff5b783f0e SwiftUI`protocol witness for SwiftUI.ListCoreDataSource.contextForItem(index: (τ_0_0.SectionIDs.Index, τ_0_0.RowIDs.Index)) -> SwiftUI._RowVisitationContext<τ_0_0> in conformance SwiftUI.ShadowListDataSource<τ_0_0> : SwiftUI.ListCoreDataSource in SwiftUI + 9
	frame #4: 0x00007fff5b91910b SwiftUI`SwiftUI.ListCoreDataSource.visitRowAt<τ_0_0>(_: (τ_0_0.SectionIDs.Index, τ_0_0.RowIDs.Index), visitor: (SwiftUI._RowVisitationContext<τ_0_0>) -> τ_1_0) -> τ_1_0 + 506
	frame #5: 0x00007fff5b917e73 SwiftUI`SwiftUI.ListCoreDataSource.visitContent<τ_0_0>(atRow: Foundation.IndexPath, visitor: (SwiftUI._RowVisitationContext<τ_0_0>) -> τ_1_0) -> τ_1_0 + 344
	frame #6: 0x00007fff5bb0b0b8 SwiftUI`SwiftUI.UITableViewListCoordinator.updateListContents(__C.UITableView) -> () + 1306
	frame #7: 0x00007fff5bb0c0f3 SwiftUI`closure #3 () -> () in performUpdates<τ_0_0, τ_0_1 where τ_0_0: SwiftUI.ListCoreDataSource, τ_0_1: SwiftUI.SelectionManager, τ_0_0.Cell: __C.UITableViewCell, τ_0_0.HeaderFooter: __C.UITableViewHeaderFooterView, τ_0_0.SelectionValue == τ_0_1.SelectionValue>() -> () + 33
	frame #8: 0x00007fff5b382ac0 SwiftUI`reabstraction thunk helper from @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> () + 12
	frame #9: 0x00007fff5b382ad6 SwiftUI`reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @callee_unowned @convention(block) () -> () + 14
	frame #10: 0x00007fff254d2d77 UIKitCore`+[UIView(Animation) performWithoutAnimation:] + 84
	frame #11: 0x00007fff5bb09fc3 SwiftUI`performUpdates<τ_0_0, τ_0_1 where τ_0_0: SwiftUI.ListCoreDataSource, τ_0_1: SwiftUI.SelectionManager, τ_0_0.Cell: __C.UITableViewCell, τ_0_0.HeaderFooter: __C.UITableViewHeaderFooterView, τ_0_0.SelectionValue == τ_0_1.SelectionValue>() -> () + 1421
	frame #12: 0x00007fff5bb12261 SwiftUI`partial apply forwarder for performUpdates<τ_0_0, τ_0_1 where τ_0_0: SwiftUI.ListCoreDataSource, τ_0_1: SwiftUI.SelectionManager, τ_0_0.Cell: __C.UITableViewCell, τ_0_0.HeaderFooter: __C.UITableViewHeaderFooterView, τ_0_0.SelectionValue == τ_0_1.SelectionValue>() -> () + 93
	frame #13: 0x00007fff5b382ac0 SwiftUI`reabstraction thunk helper from @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> () + 12
	frame #14: 0x00007fff5b382ad6 SwiftUI`reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @callee_unowned @convention(block) () -> () + 14
	frame #15: 0x00007fff254d2d77 UIKitCore`+[UIView(Animation) performWithoutAnimation:] + 84
	frame #16: 0x00007fff5bb0c2e9 SwiftUI`closure #1 () -> () in SwiftUI.UITableViewListCoordinator.updateUITableView(_: __C.UITableView, to: τ_0_0, transaction: SwiftUI.Transaction) -> () + 497
	frame #17: 0x00007fff5bb12173 SwiftUI`partial apply forwarder for closure #1 () -> () in SwiftUI.UITableViewListCoordinator.updateUITableView(_: __C.UITableView, to: τ_0_0, transaction: SwiftUI.Transaction) -> () + 99
	frame #18: 0x00007fff5b418dc9 SwiftUI`reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> (@out ()) + 12
	frame #19: 0x00007fff5bb11ffb SwiftUI`partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> (@out ()) + 17
	frame #20: 0x00007fff5bb12704 SwiftUI`reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> (@out ())partial apply forwarder with unmangled suffix ".56" + 9
	frame #21: 0x00007fff5b91438f SwiftUI`closure #1 () -> () in SwiftUI.ViewRendererHost.render(interval: Swift.Double, updateDisplayList: Swift.Bool) -> () + 2368
	frame #22: 0x00007fff5b90d5af SwiftUI`SwiftUI.ViewRendererHost.render(interval: Swift.Double, updateDisplayList: Swift.Bool) -> () + 345
	frame #23: 0x00007fff5bb39493 SwiftUI`SwiftUI._UIHostingView.layoutSubviews() -> () + 296
	frame #24: 0x00007fff5bb394d9 SwiftUI`@objc SwiftUI._UIHostingView.layoutSubviews() -> () + 21
	frame #25: 0x00007fff254dfe17 UIKitCore`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 3120
	frame #26: 0x00007fff2882b67e QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 548
	frame #27: 0x00007fff2883688f QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 65
	frame #28: 0x00007fff287727d4 QuartzCore`CA::Context::commit_transaction(CA::Transaction*, double, double*) + 610
	frame #29: 0x00007fff287aa007 QuartzCore`CA::Transaction::commit() + 699
	frame #30: 0x00007fff24f2e150 UIKitCore`_UIApplicationFlushRunLoopCATransactionIfTooLate + 70
	frame #31: 0x00007fff24fe45ba UIKitCore`__processEventQueue + 15054
	frame #32: 0x00007fff24fdbda6 UIKitCore`__eventFetcherSourceCallback + 240
	frame #33: 0x00007fff20363bdc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	frame #34: 0x00007fff20363ad4 CoreFoundation`__CFRunLoopDoSource0 + 180
	frame #35: 0x00007fff20362faf CoreFoundation`__CFRunLoopDoSources0 + 242
	frame #36: 0x00007fff2035d6f7 CoreFoundation`__CFRunLoopRun + 875
	frame #37: 0x00007fff2035cea9 CoreFoundation`CFRunLoopRunSpecific + 567
	frame #38: 0x00007fff2c951cd3 GraphicsServices`GSEventRunModal + 139
	frame #39: 0x00007fff24f2f72a UIKitCore`-[UIApplication _run] + 915
	frame #40: 0x00007fff24f34192 UIKitCore`UIApplicationMain + 101
  * frame #41: 0x000000010edd971f Shorty`main at AppDelegate.swift:13:7
	frame #42: 0x000000010f81fe1e dyld_sim`start_sim + 10

  thread #2
	frame #0: 0x00007fff6a59195e libsystem_kernel.dylib`__workq_kernreturn + 10
	frame #1: 0x00007fff6a5cd4c1 libsystem_pthread.dylib`_pthread_wqthread + 414
	frame #2: 0x00007fff6a5cc42f libsystem_pthread.dylib`start_wqthread + 15

  thread #3
	frame #0: 0x00007fff6a59195e libsystem_kernel.dylib`__workq_kernreturn + 10
	frame #1: 0x00007fff6a5cd4c1 libsystem_pthread.dylib`_pthread_wqthread + 414
	frame #2: 0x00007fff6a5cc42f libsystem_pthread.dylib`start_wqthread + 15

  thread #4
	frame #0: 0x00007fff6a59195e libsystem_kernel.dylib`__workq_kernreturn + 10

	frame #1: 0x00007fff6a5cd4c1 libsystem_pthread.dylib`_pthread_wqthread + 414
	frame #2: 0x00007fff6a5cc42f libsystem_pthread.dylib`start_wqthread + 15

  thread #5
	frame #0: 0x00007fff6a59195e libsystem_kernel.dylib`__workq_kernreturn + 10
	frame #1: 0x00007fff6a5cd4c1 libsystem_pthread.dylib`_pthread_wqthread + 414
	frame #2: 0x00007fff6a5cc42f libsystem_pthread.dylib`start_wqthread + 15

  thread #6, name = 'com.apple.uikit.eventfetch-thread'
	frame #0: 0x00007fff6a5902ba libsystem_kernel.dylib`mach_msg_trap + 10
	frame #1: 0x00007fff6a59062c libsystem_kernel.dylib`mach_msg + 60
	frame #2: 0x00007fff2036320d CoreFoundation`__CFRunLoopServiceMachPort + 319
	frame #3: 0x00007fff2035d899 CoreFoundation`__CFRunLoopRun + 1293
	frame #4: 0x00007fff2035cea9 CoreFoundation`CFRunLoopRunSpecific + 567
	frame #5: 0x00007fff2080ca5d Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 209
	frame #6: 0x00007fff2080ccd5 Foundation`-[NSRunLoop(NSRunLoop) runUntilDate:] + 72
	frame #7: 0x00007fff24fed83a UIKitCore`-[UIEventFetcher threadMain] + 491
	frame #8: 0x00007fff2083546b Foundation`__NSThread__start__ + 1066
	frame #9: 0x00007fff6a5d08fc libsystem_pthread.dylib`_pthread_start + 224
	frame #10: 0x00007fff6a5cc443 libsystem_pthread.dylib`thread_start + 15

  thread #7
	frame #0: 0x00007fff6a59195e libsystem_kernel.dylib`__workq_kernreturn + 10
	frame #1: 0x00007fff6a5cd4c1 libsystem_pthread.dylib`_pthread_wqthread + 414
	frame #2: 0x00007fff6a5cc42f libsystem_pthread.dylib`start_wqthread + 15

  thread #8
	frame #0: 0x00007fff6a59195e libsystem_kernel.dylib`__workq_kernreturn + 10
	frame #1: 0x00007fff6a5cd4c1 libsystem_pthread.dylib`_pthread_wqthread + 414
	frame #2: 0x00007fff6a5cc42f libsystem_pthread.dylib`start_wqthread + 15

  thread #9
	frame #0: 0x00007fff6a59195e libsystem_kernel.dylib`__workq_kernreturn + 10
	frame #1: 0x00007fff6a5cd4c1 libsystem_pthread.dylib`_pthread_wqthread + 414
	frame #2: 0x00007fff6a5cc42f libsystem_pthread.dylib`start_wqthread + 15

  thread #10
	frame #0: 0x00007fff6a59195e libsystem_kernel.dylib`__workq_kernreturn + 10
	frame #1: 0x00007fff6a5cd4c1 libsystem_pthread.dylib`_pthread_wqthread + 414
	frame #2: 0x00007fff6a5cc42f libsystem_pthread.dylib`start_wqthread + 15
(lldb) 

I'm seeing a similar issue - Xcode 13, view with a core data list. Preview displays the view in run mode but upon selecting I get a crash (EXC_BAD_INSTRUCTION (SIGILL)) with the same errors in crash.txt above. Previewing on device seems to work okay, its just inside Xcode its failing. Not reproducible on 12.5. To confirm, the list does get displayed correctly, but selecting anything causes the same crash.

I have the same problem. Works fine on macOS but crashes on iOS. Have you filed a radar?

I'm having the same problem, but with a List with the searchable modifier. Clicking on the cancel button or cross button to remove the text causes this.

I am in fact experiencing a similar problem in Xcode 13 when trying to delete the last item from a filtered list containing a ForEach on Core Data elements.

I am getting an "EXC_BREAKPOINT" at the first line of AppDelegate. No issues in Xcode 12 or iOS 14.

FB9158797

I ran some tests and oddly enough in my case the issue is only occurring on my iPad, not my iPhone. Anyone else?

Here's my radar for the issue: FB9188075

I managed to reproduce the crash in a sample project, attached to the radar.

is there any update on this issue?

Crashing only in Xcode 13.0 (EXC_BAD_INSTRUCTION)
 
 
Q