Test Environment: Xcode version: 13.2.1 (13C100), macOS version: 11.7.2 (20G1020) and 11.6, mac: Macbook Air M1 and Macbook Pro 13" Late 2013
How to reproduce: Just create new macOS App in Xcode and add following code to the ViewController.viewDidLoad():
print("\(TaskPriority.self)") OR Task { print("This is a test") }
Run the app, it will run fine. Enable Hardened Runtime and run the app, it crashes at above lines with signal SIGABRT. Disable Library Validation in Hardened Runtime or remove Hardened Runtime and it will run fine.
I have used Swift Concurrency in my upcoming macOS Appstore App version, and want to support macOS 11 without disabling library validation. Please let me know how this can be done. Or if this is know bug in my Xcode version, and known to be fixed later. Going to update to macOS Monterey, Xcode 13.4/14 after testing on BigSur is complete.
Thanks Quinn for looking into this, I tested with Xcode 14 and same results when running built app on macOS 11.7.2. I was using "Sign to run locally", if I sign it with even Development Team certificate it works fine.
For anyone interested in more details of root cause:
- Xcode includes libswift_Concurrency.dylib lib in Frameworks folder of built App if deployment target is < macOS 12 as it is not shipped on macOS 11.
- "Sign to run locally" signatures are invalid for library validation in Hardened Runtime, so it doesn't load libswift_Concurrency.dylib on macOS 11 and fails.