SwiftUI crash with "AttributedGraph": AG::precondition_failure(char const*, ...) ()

I am getting sporadic reports from end-users about a crash in my SwiftUI view. This is what the symbolicated crash report looks like:

Code Block
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001ba42e84c __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001d6cfc9e8 pthread_kill + 212 (pthread.c:1392)
2 libsystem_c.dylib 0x00000001972688f4 abort + 100 (abort.c:110)
3 AttributeGraph 0x00000001b5d36c7c AG::precondition_failure(char const*, ...) + 188 (ag-util.cc:51)
4 AttributeGraph 0x00000001b5d1cb84 AG::data::table::grow_region() + 288 (ag-data.cc:67)
5 AttributeGraph 0x00000001b5d1ced0 AG::data::table::alloc_page(AG::data::zone&, unsigned int) + 588 (ag-data.cc:212)
6 AttributeGraph 0x00000001b5d1d268 AG::data::zone::alloc_slow(unsigned int, unsigned int) + 228 (ag-data.cc:339)
7 AttributeGraph 0x00000001b5d1d524 AG::data::zone::alloc_bytes_recycle(unsigned int, unsigned int) + 240 (ag-data.h:417)
8 AttributeGraph 0x00000001b5d1d3b8 AG::data::zone::realloc_bytes(AG::data::ptr<void>&, unsigned int, unsigned int, unsigned int) + 112 (ag-data.cc:387)
9 AttributeGraph 0x00000001b5d25b64 AG::data::vector<AG::OutputEdge>::reserve_slow(AG::data::zone&, unsigned int) + 96 (ag-data-vector.h:191)
10 AttributeGraph 0x00000001b5d237d4 void AG::Graph::add_output_edge<AG::Node>(AG::data::ptr<AG::Node>, AG::AttributeID) + 144 (ag-data-vector.h:172)
...
73 SwiftUI 0x0000000194f3287c closure #1 in ViewRendererHost.updateViewGraph<A>(body:) + 92 (ViewRendererHost.swift:92)
74 SwiftUI 0x0000000194f2b0b4 ViewRendererHost.updateViewGraph<A>(body:) + 88 (<compiler-generated>:0)
75 SwiftUI 0x0000000194f31328 ViewRendererHost.sizeThatFits(_:) + 112 (ViewRendererHost.swift:249)
76 SwiftUI 0x0000000195087980 _UIHostingView.sizeThatFits(_:) + 112 (UIHostingView.swift:1865)
77 SwiftUI 0x00000001950879c8 @objc _UIHostingView._baselineOffsets(at:) + 48
78 UIKitCore 0x0000000190b58bf8 -[UIView(_UIConstraintBasedLayoutEmbedding) _layoutSizeThatFits:fixedAxes:] + 84 (UIView_UnifiedLayout.m:27)
79 UIKitCore 0x00000001911f5214 -[UIView(UIConstraintBasedLayout) intrinsicContentSize] + 92 (NSLayoutConstraint_UIKitAdditions.m:2112)
86 CoreAutoLayout 0x00000001a2b73934 -[NSISEngine withBehaviors:performModifications:] + 80 (NSISEngine.m:1917)
87 UIKitCore 0x00000001911fea98 __100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke + 88 (NSLayoutConstraint_UIKitAdditions.m:4458)
88 UIKitCore 0x00000001911fd4bc -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 120 (NSLayoutConstraint_UIKitAdditions.m:4157)
89 UIKitCore 0x00000001911fe6e4 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 160 (NSLayoutConstraint_UIKitAdditions.m:4457)
90 UIKitCore 0x00000001911ff6bc -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 428 (NSLayoutConstraint_UIKitAdditions.m:4722)
91 UIKitCore 0x00000001912cee00 -[UIView(Hierarchy) layoutBelowIfNeeded] + 860 (UIView.m:12277)
92 CJournal 0x00000001029e2894 MapCalloutView.setupView() + 948 (MapCalloutView.swift:80)
93 CJournal 0x00000001029e2aa0 specialized MapCalloutView.init(rootView:) + 320 (MapCalloutView.swift:43)
94 CJournal 0x0000000102a3b01c MapCalloutView.init(rootView:) + 8 (MapCalloutView.swift:0)
95 CJournal 0x0000000102a3b01c MapCalloutView.__allocating_init(rootView:) + 24 (CJMapsCalloutController.swift:19)
96 CJournal 0x0000000102a3b01c CJMapsCalloutController.makeMapsCalloutView() + 252
97 CJournal 0x0000000102a3b070 @objc CJMapsCalloutController.makeMapsCalloutView() + 28 (<compiler-generated>:0)
98 CJournal 0x00000001027cb2a8 -[CJCustomAnnotationView setupAnnotationDetailAccessoryViewWithAddress:] + 312 (CJCustomAnnotationView.m:114)
99 CJournal 0x00000001027cb154 -[CJCustomAnnotationView setupAnnotationForPersonAddress:] + 553300 (CJCustomAnnotationView.m:0)
100 CJournal 0x00000001027cb370 -[CJCustomAnnotationView setupAnnotationForClusterAnnotation:] + 553840 (CJCustomAnnotationView.m:0)
101 CJournal 0x00000001027cad70 -[CJCustomAnnotationView configureAnnotationViewWithAnnotation:] + 552304 (CJCustomAnnotationView.m:38)
102 CJournal 0x00000001027cacec -[CJCustomAnnotationView initWithAnnotation:reuseIdentifier:withDefaultColor:withCalloutDelegate:] + 552172 (CJCustomAnnotationView.m:32)
103 CJournal 0x0000000102884f74 -[MapViewShared annotationViewForMap:forAnnotation:withCalloutDelegate:] + 1314676 (MapViewShared.m:62)


I'm not displaying a complicated SwiftUI view ... it's not based on List or Form and doesn't have Navigation either, though it does use GeometryReader in some cases (which doesn't seem to be part of this stack trace). The SwiftUI view is shown as part of an MKAnnotationView's detailCalloutAccessoryView. I use a wrapper UIView in which there is a UIHostingController, which is what contains the SwiftUI view.

Would love any help or insight into this issue. Unfortunately I can't reproduce it on my end currently, so would be very helpful to get more details from the stack trace if possible.

bump Would love some feedback on this.

Using the GeometryProxy outside of SwiftUI body seems to be unsafe and causing the "AttributeGraph precondition failure: setting value during update: 634424." fatal error. Make sure to copy the necessary information into a variable before storing it for later use or capturing by a DispatchQueue.async or Task closure.

SwiftUI crash with "AttributedGraph": AG::precondition_failure(char const*, ...) ()
 
 
Q