I’m trying to run dotnet console program, which has Console.ReadKey function call. It fails because Debug Console is redirected and it does not support reading keyboard. I tried to set externalTerminal in the Cursor settings and launch settings, but it seems it is completely ignored.
Steps to Reproduce
Create dotnet a console program with Console.ReadKey line
Exception has occurred: CLR/System.InvalidOperationException
An unhandled exception of type ‘System.InvalidOperationException’ occurred in System.Console.dll: ‘Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.’
at System.ConsolePal.ReadKey(Boolean intercept)
Hey, thanks for the report. It looks like this is a limitation of the Anysphere C# extension. Some launch configuration options that work in VS Code aren’t fully supported yet. There was a similar report recently where pipeTransport was also being ignored.
A couple things to try:
In your launch.json, set "console": "integratedTerminal" instead of "externalTerminal". The integrated terminal should support Console.ReadKey since it isn’t redirected like the Debug Console.
If that still doesn’t work, could you share your launch.json config? That’ll help us see what exactly is being ignored.
I’ve reported this to the team. No ETA yet, but your report helps us prioritize it.