Hi,
I am porting a .NET core console application to Torizon.
The original application uses Console.ReadKey() to take commands from the user. This works fine when running in release but fails when debuging.
I suspect this is because of all the ssh magic that is happening when debuging the remote container.
The simple snipet below reproduces the issue:
using System;
namespace test_terminal
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var i_KeyInfo = Console.ReadKey(true);
Console.WriteLine(i_KeyInfo.Key);
}
}
}
I get the following error:
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.'
I did some research online and I found some sources that indicated that I should change the launch.json
configuration to fix this.
So, I changed configurations.console
to integratedTerminal
from internalConsole
.
I can’t notice any change difference after this change.
This are the contents of torizon-vscode-settings.yml
label: .NET Console Application
detail: >-
$(terminal) Creates a minimal console application sample, based on a debian
container and .NET Core 3.1
tags:
- console
testing:
title: .NET 5.0
createCmd: torizon.createDotNetCoreApp
createSelection: .NET Console Application
projName: DotnetConsoleApp
platformDistroCodeName: bullseye
baseContainer: dotnet-50_bullseye
mainSourceFile: Program.cs
mainSourceFileBreakPoint: 9
programOutput: Hello World
hasSDKContainer: false
stopOnEntry: false
extversion: 1.3.0
Am I doing something wrong ? Or is this simply not supported when debugging in Torizon ?
Thanks,
Jaume