Crash calling UIHostingController from a Swift Package

Hello team,

We recently found a EXC_BAD_ACCESS crash when using UIHostingControllers on a SPM local Package in our application. This is happening from time to time when we run the app on simulators using Debug configurations.

Also, this issue is consistent when we run application tests, there is something weird that we found after making a research... If we disable app test target and only keep packages tests, the crash is not happening, but as soon as we re-enable the app test target from the test suite the crash returns.

This is the full error message:

Thread 1: EXC_BAD_ACCESS (code=1, address=0xbad4017) A bad access to memory terminated the process.

Is this s known issue? We've been performing explorations for some days and couldn't find any real solution for this.

A basic call on UIHostingController inside of a SPM local Package is enough to make the app crash, nothing custom being done: UIHostingController(rootView: MyView())

Forgot to add this to the main message. This error is happening on Xcode 16.0 and 16.1, we recently tried to perform this migration and this error is blocking us to continue.

@pacocd Take a look at the documentation for debugging techniques that has guidance on debugging common reasons for a crash. If you get stuck, let us know what you tried, and attach the fully symbolicated Apple crash report in your reply.

Posting a Crash Report explains how to do so.

Crash calling UIHostingController from a Swift Package
 
 
Q