I launch the macOS app from Xcode after recently updating to Sonoma and now I get this.
I would think that Foundation is automatically included. I took the extra step to add Foundation and Cocoa to the Frameworks and Libraries with the Do Not Embed option and it didn't fix it. I also tried Embed Wthout Signing, which didn't work either.
Any suggestions?