muhammadsammy / free-vscode-csharp

Free/Libre fork of the official C# extension for vscode

Home Page:https://open-vsx.org/extension/muhammad-sammy/csharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to read input from the console with C#

nightblade9 opened this issue · comments

Issue Description

VSCode terminal doesn't allow me to read from the console. Two things that appear incorrect:

  • When I run my application, the output appears in Debug Console instead of in Terminal
  • When I type anything in Debug Console, I get error 80070057

Steps to Reproduce

Simple option: follow these MSDN instructions.

My distilled-down version:

  • `dotnet new console --name test
  • Open up Program.cs and add your choice of Console.Read, Console.ReadLine, or Console.ReadKey to the end
  • Configure VSCode with launch.json - make sure you set console to integratedTerminal or externalTerminal
  • I was told to also set internalConsoleOptions to neverOpen, although this seems to make no difference
  • Run/debug the application
  • Type something. Anything.

Expected Behavior

You should be able to read from the terminal and continue running the application

Actual Behavior

There is no way to send input in.

  • Typing anything in the Debug Console prints error 0x80070057
  • Typing anything in Terminal closes the terminal

Logs

I don't know what logs to provide, please advise.

OmniSharp log

Starting OmniSharp server at 3/19/2023, 12:12:23 p.m.
    Target: /home/nb/code/obsidian-mountain/source/ObsidianMountain.sln

OmniSharp server started with .NET 6.0.113
.
    Path: /home/nb/.vscode-oss/extensions/muhammad-sammy.csharp-1.25.0-universal/.omnisharp/1.39.0-net6.0/OmniSharp.dll
    PID: 7498

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to /usr/share/dotnet/dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: .NET Core SDK 6.0.113 17.0.1 - "/usr/share/dotnet/sdk/6.0.113/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: .NET Core SDK 6.0.113 17.0.1 - "/usr/share/dotnet/sdk/6.0.113/"
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/home/nb/code/obsidian-mountain/source/ObsidianMountain.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/nb/code/obsidian-mountain/source/ObsidianMountain.Console/ObsidianMountain.Console.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/nb/code/obsidian-mountain/source/ObsidianMountain.Core/ObsidianMountain.Core.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/nb/code/obsidian-mountain/source'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/nb/code/obsidian-mountain/source' on host 7334.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/nb/code/obsidian-mountain/source/ObsidianMountain.Console/ObsidianMountain.Console.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/nb/code/obsidian-mountain/source/ObsidianMountain.Console/ObsidianMountain.Console.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/nb/code/obsidian-mountain/source/ObsidianMountain.Console/ObsidianMountain.Console.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/nb/code/obsidian-mountain/source/ObsidianMountain.Core/ObsidianMountain.Core.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/nb/code/obsidian-mountain/source/ObsidianMountain.Core/ObsidianMountain.Core.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/nb/code/obsidian-mountain/source/ObsidianMountain.Core/ObsidianMountain.Core.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: ObsidianMountain.Console
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: ObsidianMountain.Core

C# log

There is nothing logged in Output -> C#

Environment information

VSCode version: 1.75.1
C# Extension: 1.25.0

Mono Information There is a problem with running OmniSharp on mono: Error: Unable to find Mono. Ensure that Mono's '/bin' folder is added to your environment's PATH variable.
Dotnet Information .NET SDK (reflecting any global.json): Version: 6.0.113 Commit: 4a23b50f97

Runtime Environment:
OS Name: manjaro
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /usr/share/dotnet/sdk/6.0.113/

Host:
Version: 7.0.2
Architecture: x64
Commit: d037e070eb

.NET SDKs installed:
6.0.113 [/usr/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.NETCore.App 6.0.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
DOTNET_ROOT [/usr/share/dotnet]

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Visual Studio Code Extensions
Extension Author Version
csharp muhammad-sammy 1.25.0
markdown-preview-enhanced shd101wyy 0.6.8
simple-rst trond-snekvik 1.5.2

See #38
to debug code with ReadLine use Miscrosoft extension with their VS Code. C# Dev Kit / C#
Or don't use ReadLine