Privacy crash when executable runs in XCode

Hello

I have an executable (not an app bundle) which accesses the microphone. When I run it in XCode it crashes with

"[access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data."

The required key/value is present in the Info.plist. I can also embed it into the binary and verify the presence of the key/value pair with otool.

If I run the executable outside XCode (Terminal, Finder) no problem occurs. That's even true if I don't embed the Info.plist. The situation is really absurd: running outside XCode WITHOUT the microphone usage key doesn't crash, running inside XCode WITH the microphone usage key does crash.

XCode itself does not ask for microphone access, even after clearing permissions with 'tccutil reset Microphone'.

1) How can I solve the crash issue in XCode?
2) Why does the executable not crash outside XCode without embedding an Info.plist containing the microphone usage key?

Privacy crash when executable runs in XCode
 
 
Q