Skip to content

Error occurs when running a script that uses Console.Readkey / ReadLine #6

Open
@glennblock

Description

@glennblock
Found package reference: C:\code\scriptcs\samples\servicestackhost\packages\ServiceStack.3.9.37\lib\net35
Found package reference: C:\code\scriptcs\samples\servicestackhost\packages\ServiceStack.Common.3.9.37\lib\net35
Found package reference: C:\code\scriptcs\samples\servicestackhost\packages\ServiceStack.Redis.3.9.37\lib\net35
Found package reference: C:\code\scriptcs\samples\servicestackhost\packages\ServiceStack.Text.3.9.37\lib\net35
listening on http://*:999/

Unhandled Exception: System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.
   at System.Console.ReadKey(Boolean intercept)
   at Submission#0..ctor(Session session, Object& submissionResult)
   at Submission#0.<Factory>(Session session)
   at Roslyn.Scripting.CommonScriptEngine.Execute[T](String code, String path, DiagnosticBag diagnostics, Session session, Boolean isInteractive)
   at Roslyn.Scripting.Session.Execute(String code)
   at ScriptCs.Wrappers.SessionWrapper.Execute(String code) in c:\code\scriptcs\src\ScriptCs.Core\Wrappers\SessionWrapper.cs:line 17
   at ScriptCs.ScriptExecutor.Execute(String script, IEnumerable`1 paths, IEnumerable`1 scriptPacks) in c:\code\scriptcs\src\ScriptCs.Core\ScriptExecutor.cs:line 47
   at ScriptCs.Program.Main(String[] args) in c:\code\scriptcs\src\ScriptCs\Program.cs:line 28
[Finished in 10.6s]

Looks like a buffer needs to be passed the process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions