Using relationships in SortDescriptor crashing on release

If use a SortDescriptor for a model and sort by some attribute from a relationship, in DEBUG mode it all works fine and sorts. However, in release mode, it is an instant crash.

  • SortDescriptor<Task>(.name, order: .reverse) ---- works
  • SortDescriptor<Task>(.assignedUser?.name, order: .reverse) ---- works in debug but crash in release.

What is the issue here, is it that SwiftData just incompetent to do this?

Is this issue the same as the one discussed here? If yes, please follow up in that thread so all the information is consolidated there.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

@DTS Engineer the issue [@Ches Beiner](https://developer.apple.com/forums/profile/Ches Beiner) brought up is still an issue, as detailed in my post on the thread you linked to: SwiftData crash when using a @Query sort descriptor with a relationship

Using relationships in SortDescriptor crashing on release
 
 
Q