swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.3k stars 10.34k forks source link

withCheckedContinuation crashes on Xcode 16 RC #75952

Open MarkVillacampa opened 3 weeks ago

MarkVillacampa commented 3 weeks ago

Description

I can reproduce on Xcode 16 RC and Xcode 16.1 beta, but ONLY when running the app as "Designed for iPhone/iPad" on macOS Sonoma, and ONLY in debug mode (crash goes away in release mode).

I cannot reproduce by running on iOS 17 or 18 neither device nor simulator, and cannot reproduce either when running on macOS Sequoia beta.

Some developers have reported the issue also reproduces when installing the app via TestFlight on an iOS 18 device.

Original issue: https://github.com/RevenueCat/purchases-ios/issues/4177

FB14855530

Reproduction

_ = try await withCheckedContinuation { continuation in
    continuation.resume(returning: true)
}

Stack dump

Thread 0 Crashed:
0   asdfsadf.debug.dylib                   0x102551354 withCheckedContinuation<A>(isolation:function:_:) + 232
1   asdfsadf.debug.dylib                   0x102551135 closure #1 in closure #2 in ContentView.body.getter + 1 (ContentView.swift:21)
2   asdfsadf.debug.dylib                   0x102552299 partial apply for closure #1 in closure #2 in ContentView.body.getter + 1
3   libswift_Concurrency.dylib             0x2548aa0f9 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1

Expected behavior

It doesnt crash

Environment

Xcode 16.1 beta 1

Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1) Target: arm64-apple-macosx14.0

Additional information

No response

MarkVillacampa commented 3 weeks ago

Quick update:

_ = try await withCheckedThrowingContinuation { continuation in
    continuation.resume(returning: true)
}
mszyszylo commented 1 week ago

Same issue for me.

I'm on Xcode 16.1 beta.

App crashes like @MarkVillacampa described with only iOS 18 simulators.

Thread 1: EXC_BAD_ACCESS (code=1, address=0x4)

MarkVillacampa commented 6 days ago

The crash is still present in Xcode 16 RC when running a Debug build as "Designed for iPad/iPhone" on macOS Sonoma

random-yang commented 5 days ago

Has anyone posted a question on the Apple Developer Forum, and is there a final solution to the problem?

kiran-nayak-cheq commented 3 days ago

+1. Any update on this?

random-yang commented 2 days ago

@kiran-nayak-cheq Looks like the issue has been fixed in the updated version? https://developer.apple.com/forums/thread/761580 https://forums.developer.apple.com/forums/thread/762682?page=1#803104022