The calling thread must be STA, because many UI components require this. - error in Interactive Window

I’m getting the following error when I execute a command interactively in the PowerShell Interactive Window in VS 2019:

PS C:\Users\Steve James> Stop-Process -Id 16496 -Confirm
[ERROR] 
[ERROR] Stop-Process: The calling thread must be STA, because many UI components require this.

I’ve selected PowerShell 7 (x64) and enabled Single Threaded Apartment State (STA) in Options.

Any ideas what is wrong?

I can reproduce this. It has to do with the -Confirm flag. Once I remove that, it works. I’ve opened an issue here: -Confirm flag doesn't work in Visual Studio · Issue #806 · ironmansoftware/issues · GitHub