SIGABRT on throw instruction in C++ code file of VisionOS project in Xcode 15 beta

I'm getting a weird crash from the template VisionOS app (the one that appears upon creating a new VisionOS project). I went and modified the code to use two additional C++ files, one of which throws an exception upon a specific circumstance, and another one that catches and handles the exception.

If I attempt to run the app with the new code, instead of the code catching the exception, I get a SIGABRT signal, as if C++ exceptions were not enabled at project level.

The following gist contains a minimal example with the weird behavior:

https://gist.github.com/Izhido/100a92f45aaf8bacffe73893d6109077

Replace the contents of the template VisionOS project with these files, run the project, and press the "Do sum" button. Xcode 15 beta will report a SIGABRT signal at sumofnumbers_impl.cpp, line 8.

What am I missing here?

(Incidentally, the same code in a MacOS project runs just fine - I can share the project upon request. Also, for some reason I cannot share screenshots or files in this forum - that's why I provided the gist.)

That certainly seems weird. We just released new visionOS stuff yesterday. Were you testing with the new stuff?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Yeah, I noticed last night Beta 5 was released along with a new simulator. I removed Beta 4 and reinstalled the new one.

Unfortunately, the weird issue persists.

Do you reckon I need to do something special to the project to make sure I'm really using the latest version of everything? Or should it be already working as it is?

Thanks for confirming that.

I tried this myself and got the same result. Here’s the backtrace of the crash:

(lldb)  bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    … #0:  … libsystem_kernel.dylib`__pthread_kill + 10
    … #1:  … libsystem_pthread.dylib`pthread_kill + 263
    … #2:  … libsystem_c.dylib`abort + 133
    … #3:  … libc++abi.dylib`__cxxabiv1::readEncodedPointer(unsigned char const**, unsigned char, unsigned long) + 269
    … #4:  … libc++abi.dylib`__gxx_personality_v0 + 399
    … #5:  … libunwind.dylib`_Unwind_RaiseException + 401
    … #6:  … libc++abi.dylib`__cxa_throw + 108
  * … #7:  … Test734484`sum_numbers_impl(top=15) at sumofnumbers_impl.cpp:8:3
    … #8:  … Test734484`sum_numbers(top=15) at sumofnumbers.cpp:8:10
    … #9:  … Test734484`closure #2 in closure #2 in ContentView.body.getter at ContentView.swift:29:30
    …

Frame 9 is your SwiftUI button handler, which calls your C++ code which throws an exception at frame 7. The exception runtime is busily unwinding the stack, a process that involves reading C++ exception handler tables. In frame 3 it gets a value it doesn’t understand and calls abort.

This stuff should just work out of the box, as it did when you tested the same code in a macOS project. I don’t know enough about the C++ runtime to say why it’s not working in this case, but it’s definitely something that we need to look into.

I’d appreciate you filing a bug about this, making sure to include a copy of your test project. And please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I was not aware there was a direct way to post bug reports. Thank you so much for sharing!

The feedback has been posted. Bug number FB12790129.

Appreciated!

Hi @Izhido_XR , I ran this on an M1 MacBook and did not see any crashes. I used Xcode 15 beta 5 from the developer site as well, so there was no difference on that. This seems to be an Intel problem with the simulator

Finally got an answer from the posted feedback. 4 months later.

The answer? "Please know that visionOS simulator isn’t supported on Intel machines. Developing for visionOS requires a Mac with Apple silicon."

sigh

  1. That's obviously what they were going to say;
  2. It took 1+ month after they disabled the simulator in Intel-based machines, and introduce the other one, before answering;
  3. Despite what I said earlier, I just don´t have the money to get a new machine.

Have you guys, ever wished, so hard, to give a collective "f****k you" to a whole company, but had to resist to do it on grounds of not wishing to have your reputation and professionalism level brought directly into the ground?

That's me right now.

4 months ago:

I was not aware there was a direct way to post bug reports. Thank you so much for sharing!

Today:

Have you guys, ever wished, so hard, to give a collective "f****k you" to a whole company

Thanks for your feedback about the "Feedback Assistant" experience. So that we can be sure that your feedback reaches the right people, I’d appreciate you filing a bug about this. And please post your bug number, just for the record.

SIGABRT on throw instruction in C++ code file of VisionOS project in Xcode 15 beta
 
 
Q