I have recently encountered issues with the usage of `async let` on iOS 15.4 (sim and physical devices) and macOS 12.3 (M1 mac mini) - tested with both xcode 13.3 and 13.2.1
The issue is reproducible with the following rudimentary sample with xcode's default project settings:
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello, world!")
.padding()
.task {
async let testModel = TestModel()
_ = await testModel
}
}
}
struct TestModel {
let a: String? = nil
let b: String? = nil
let c: String? = nil
let d: String? = nil
let e: String? = nil
let f: String? = nil
let g: String? = nil
let h: String? = nil
let i: String? = nil
let j: String? = nil
let k: String? = nil
let l: String? = nil
let m: String? = nil
let n: String? = nil
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Some notes on what I have noticed during testing:
The number of `TestModel`'s properties has to be exactly 14 to reproduce the crash.
If the code optimization (`-Os/-O`) is used, then the crash doesn't occur anymore.
If `= TestModel()` is encapsulated in a closure `= {TestModel()}` then the crash also doesn't occur anymore.
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: a180b45c64f8fa62f2f64bec092d2247Issue Description:
I have recently encountered issues with the usage of `async let` on iOS 15.4 (sim and physical devices) and macOS 12.3 (M1 mac mini) - tested with both xcode 13.3 and 13.2.1
The issue is reproducible with the following rudimentary sample with xcode's default project settings:
Some notes on what I have noticed during testing:
The number of `TestModel`'s properties has to be exactly 14 to reproduce the crash.
If the code optimization (`-Os/-O`) is used, then the crash doesn't occur anymore.
If `= TestModel()` is encapsulated in a closure `= {TestModel()}` then the crash also doesn't occur anymore.
The full stacktrace of the `EXC_BAD_ACCESS`