Something to quickly double-check before going further: are you running the latest Xcode (11.1) on macOS Catalina?
yes everything is updated
In that case it sounds like something the Xcode team need to take a look at. Go to https://feedbackassistant.apple.com/ and file a report there (you want Developer Tools, then Xcode). Describe exactly what happens (there's lots of specific prompts to fill in), include the exact versions of your OS and Xcode, and attach a zip file of the project (or of a simple project that reproduces the issue). Along with that, attach a system diagnosis report, which is what all good bugs need—it includes all the logs and other bits of useful information about what the system is doing at the time; if there's something different about your system that's causing the error, chances are the sysdiagnose will contain everything they need to root out the issue.
To generate a system diagnosis:
- Reproduce the issue. Note the time at which you do so (or a range: started at X, tried Y times, ended at Z) to include in the bug report.
- Press the following keys together: Control-Option-Command-Shift-Period (⌃⌥⌘⇧.) and the system will start assembling an archive for you.
- After a couple of minutes, a Finder window will open and display a file named sysdiagnose_XXXX.tar.gz, where XXXX is the time & date the diagnosis was collected.
- Drag that file into the attachments list on your bug report, then click Save to send the report to Apple.
It's probably worth including a link to this forum post in the bug report. If the solution is straightforward, the engineer may well reply here telling you how to resolve the issue. This sounds a little more complex, though, since I'm not able to reproduce it on a clean installation here.
One other thing to include in your bug report: record a video of the error happening.
- Press Cmd-Shift-5.
- In the dialog at the bottom of the screen, select “Record Selected Portion,” the rightmost icon.
- Drag the edges of the selection rectangle that appears so they enclose your Xcode window.
- In the ‘Options’ menu of the capture dialog, set ‘Microphone’ to ‘None’ (unless you plan to narrate) and enable ‘Show Mouse Clicks.’
- Click Record on the dialog at the bottom of the screen. Note that a ‘Stop’ button appears in your menubar.
- Use Xcode and reproduce the issue.
- The mouse cursor will be recorded, so feel free to use it to circle & draw attention to certain things.
- Don't move the mouse super-quickly; ensure the viewer will be able to follow its movement with their eyes.
- If you're typing anything, move the mouse cursor to where you're going to type and click there, to draw attention to where you'll type.
- Click the ‘Stop’ button in the menu bar.
The recording will appear in a hovering window at the bottom-right of your screen, just as a screenshot would. You can drag that window directly onto the feedback report, or you can wait for it to be saved (to the Desktop, by default) and drag the file from there.