SwiftUI: protocol witness for Projection.get(base:) in conformance WritableKeyPath<A, B> + 24

Hi, for my app, which supports minimum iOS 14, I'm getting frequent test flight crashes in regards to this:

SwiftUI: protocol witness for Projection.get(base:) in conformance WritableKeyPath<A, B> + 24. (Full thread crash at end.)

The crash logs don't indicate specifically where this occurs, only that it occurs in SwiftUI directly.

I was advised by someone that this was due to using indices in ForEach and have since modified any ForEach statements to now use Identifiable arrays instead of possibly none-constant index range.

I have noticed that these crashes only occur in iOS 14.* and 15.*.

Does anyone know another possible reason for this type of crash or an iOS < 16 fix?

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001e51d78c8
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [14367]

Triggered by Thread:  0


Thread 0 name:
Thread 0 Crashed:
0   libswiftCore.dylib            	0x00000001e51d78c8 closure #1 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 360 (AssertCommon.swift:96)
1   libswiftCore.dylib            	0x00000001e51d762c closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 196 (AssertCommon.swift:0)
2   libswiftCore.dylib            	0x00000001e51d7434 closure #1 in _assertionFailure(_:_:file:line:flags:) + 208 (AssertCommon.swift:0)
3   libswiftCore.dylib            	0x00000001e51d6f7c _assertionFailure(_:_:file:line:flags:) + 232 (AssertCommon.swift:85)
4   libswiftCore.dylib            	0x00000001e51b14ac _ArrayBuffer._checkInoutAndNativeTypeCheckedBounds(_:wasNativeTypeChecked:) + 280 (ContiguousArrayBuffer.swift:575)
5   libswiftCore.dylib            	0x00000001e51b5bac Array.subscript.getter + 88 (Array.swift:383)
6   libswiftCore.dylib            	0x00000001e52fe548 RawKeyPathComponent._projectReadOnly<A, B, C>(_:to:endingWith:) + 980 (KeyPath.swift:1596)
7   libswiftCore.dylib            	0x00000001e52fdd08 closure #1 in KeyPath._projectReadOnly(from:) + 700 (KeyPath.swift:255)
8   libswiftCore.dylib            	0x00000001e5302dc0 swift_getAtKeyPath + 252 (<compiler-generated>:0)
9   SwiftUI                       	0x00000001e842d248 protocol witness for Projection.get(base:) in conformance WritableKeyPath<A, B> + 24 (<compiler-generated>:0)
10  SwiftUI                       	0x00000001e83e3b1c ProjectedLocation.update() + 260 (Location.swift:152)
11  SwiftUI                       	0x00000001e83fbe58 LocationBox.update() + 96 (Location.swift:86)
12  SwiftUI                       	0x00000001e85edca8 protocol witness for Location.update() in conformance LocationBox<A> + 24 (<compiler-generated>:0)
13  SwiftUI                       	0x00000001e83e3aec ProjectedLocation.update() + 212 (Location.swift:151)
14  SwiftUI                       	0x00000001e83fbe58 LocationBox.update() + 96 (Location.swift:86)
15  SwiftUI                       	0x00000001e8466b64 Binding.ScopedLocation.update() + 56 (Binding.swift:376)
16  SwiftUI                       	0x00000001e83fbe58 LocationBox.update() + 96 (Location.swift:86)
17  SwiftUI                       	0x00000001e83afb84 Binding.Box.update(property:phase:) + 400 (Binding.swift:351)
18  SwiftUI                       	0x00000001e8362888 static BoxVTable.update(ptr:property:phase:) + 444 (DynamicPropertyBuffer.swift:291)
19  SwiftUI                       	0x00000001e83bf6dc _DynamicPropertyBuffer.update(container:phase:) + 104 (DynamicPropertyBuffer.swift:215)
20  SwiftUI                       	0x00000001e835e5ec DynamicBody.updateValue() + 596 (DynamicProperty.swift:378)
21  SwiftUI                       	0x00000001e83a5bd4 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 32 (<compiler-generated>:0)
22  AttributeGraph                	0x0000000212b9fb18 AG::Graph::UpdateStack::update() + 524 (ag-closure.h:109)
23  AttributeGraph                	0x0000000212b9f508 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 396 (ag-graph-update.cc:734)
24  AttributeGraph                	0x0000000212b9e318 AG::Subgraph::update(unsigned int) + 876 (ag-subgraph.cc:731)
25  SwiftUI                       	0x00000001e831d124 GraphHost.flushTransactions() + 428 (GraphHost.swift:558)
26  SwiftUI                       	0x00000001e8ff0da8 closure #1 in closure #1 in closure #1 in GraphHost.asyncTransaction<A>(_:mutation:style:mayDeferUpdate:) + 24 (GraphHost.swift:467)
27  SwiftUI                       	0x00000001e830e784 partial apply for closure #1 in ViewGraphDelegate.updateGraph<A>(body:) + 28 (ViewGraph.swift:38)
28  SwiftUI                       	0x00000001e831a618 closure #1 in ViewRendererHost.updateViewGraph<A>(body:) + 108 (ViewRendererHost.swift:126)
29  SwiftUI                       	0x00000001e83130f8 ViewRendererHost.updateViewGraph<A>(body:) + 96 (<compiler-generated>:0)
30  SwiftUI                       	0x00000001e830c110 ViewGraphDelegate.updateGraph<A>(body:) + 84 (ViewGraph.swift:38)
31  SwiftUI                       	0x00000001e830b1a4 closure #1 in GraphHost.init(data:) + 156
32  SwiftUI                       	0x00000001e8418798 thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:0)
33  SwiftUI                       	0x00000001e83095b4 static NSRunLoop.flushObservers() + 144 (<compiler-generated>:0)
34  SwiftUI                       	0x00000001e8309640 closure #1 in closure #1 in static NSRunLoop.addObserver(_:) + 40 (StandardLibraryAdditions.swift:809)
35  SwiftUI                       	0x00000001e83f9540 specialized thunk for @callee_guaranteed () -> (@error @owned Error) + 24 (<compiler-generated>:0)
36  libswiftObjectiveC.dylib      	0x000000020f297a10 autoreleasepool<A>(invoking:) + 64 (ObjectiveC.swift:172)
37  SwiftUI                       	0x00000001e83094d8 closure #1 in static NSRunLoop.addObserver(_:) + 64 (StandardLibraryAdditions.swift:809)
38  SwiftUI                       	0x00000001e83097a8 @objc closure #1 in static NSRunLoop.addObserver(_:) + 56 (<compiler-generated>:0)
39  CoreFoundation                	0x00000001e070d0c4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 (CFRunLoop.c:1804)
40  CoreFoundation                	0x00000001e06dc080 __CFRunLoopDoObservers + 592 (CFRunLoop.c:1917)
41  CoreFoundation                	0x00000001e06d713c __CFRunLoopRun + 1052 (CFRunLoop.c:2979)
42  CoreFoundation                	0x00000001e06eabc8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
43  GraphicsServices              	0x00000001fc856374 GSEventRunModal + 164 (GSEvent.c:2200)
44  UIKitCore                     	0x00000001e305eb58 -[UIApplication _run] + 1100 (UIApplication.m:3511)
45  UIKitCore                     	0x00000001e2de0090 UIApplicationMain + 364 (UIApplication.m:5064)
47  dyld                          	0x00000001063b1da4 start + 520 (dyldMain.cpp:879)

Have you found any solution or cause for this? I'm having the same issue in iOS 17 right now and I can't understand why it's happening. I've also found out that WritableKeyPath<A, B> is a RxSwift method, but removing the library didn't help.

SwiftUI: protocol witness for Projection.get(base:) in conformance WritableKeyPath&lt;A, B&gt; + 24
 
 
Q