iOS14 Autorotation bug with debugger & AVCaptureSession

I am seeing an unusual autorotation bug in iOS 14 (beta 3). I have an XCode project with some AVFoundation (AVCaptureSession) & Metal code to setup camera and rendering of camera frames. Here is the strange thing about bug.
  1. Build the project with XCode 12 and run on iOS 14 device. The view controller doesn't autorotate when connected to debugger. When the app is opened without debugger, autorotation happens,

  2. Once Autorotation is blocked in debugger, it gets blocked forever for the XCode project. Meaning, if I change the initial view controller to some dummy view controller, it too fails to autorotate!!! Only way is to make a new XCode project to reproduce the issue. Deleting/Reinstalling the app, clean build, nothing helps.

  3. This does not happen on iOS 13 devices.

Reproducible test case is very difficult to make as there is lot of code. I tried trimming a lot of code but then it is not reproducible. And even to find the culprit code, I will need to make a new XCode project everytime as the project once dead is dead forever!
Is anyone aware of similar issue? Any inputs would be appreciated.
I found the bug. This is caused by a single line of code such as
Code Block
 public var metalDevice:MTLDevice? = MTLCreateSystemDefaultDevice()

Can't believe such a terrible bug is not encountered by anyone so far?
iOS14 Autorotation bug with debugger & AVCaptureSession
 
 
Q