File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,16 @@ internal extension NSRelationshipDescription {
2424 case . toMany:
2525 self . minCount = 0
2626 self . maxCount = 0
27- self . isOrdered = true
27+ // - Note: To-many relationships are deliberately *unordered*.
28+ // CoreData forbids an ordered relationship whose inverse is also
29+ // ordered — `momc` rejects it at build time, but a model built
30+ // programmatically is never validated, so a many-to-many (e.g.
31+ // `Person.events` / `Event.people`) silently produced an invalid
32+ // model. Deleting an object then corrupted memory while CoreData
33+ // propagated the delete through the faulted ordered set, crashing
34+ // with EXC_BAD_ACCESS inside `-[NSManagedObject _propagateDelete:]`.
35+ // ``RelationshipValue/toMany(_:)`` carries no ordering guarantee
36+ // anyway, and unordered is CoreData's own default.
2837 assert ( isToMany)
2938 }
3039 }
You can’t perform that action at this time.
0 commit comments