Xcode 16 Previews: Always crash when compilation mode is WMO

This can be easily reproduced in a vanilla Xcode 16 beta 3 project.

Steps

  1. Create a new project.
  2. By default, previews work fine because default SWIFT_COMPILATION_MODE is Incremental. (aka Batch Mode)
  3. Now, change it to WMO, and notice the previews crash with the enclosed crash report.

Feedback filed with reproducer + diagnostics + crash report: https://feedbackassistant.apple.com/feedback/14268698

We have observed that enabling Whole Module Optimization (WMO) improves build times in our project. Therefore, if Previews can be compatible with WMO, it would be highly beneficial. Otherwise, it would be helpful to provide a warning or feedback to developers, as many projects are likely utilizing WMO, and identifying issues solely from crash reports can be challenging.

Note: This works all fine with the Legacy Previews Engine in Xcode 15/16.

Hi,

Thanks for bringing this to our attention, and for filing a feedback with a reproducer! It has already made it to the right team, so expect any follow up to come via the normal feedback channels.

Please do keep reporting any further issues or improvements you can think of!

Xcode 16 Previews: Always crash when compilation mode is WMO
 
 
Q