Bug 27597 - csharp REPL on Windows doesn't accept any input
Summary: csharp REPL on Windows doesn't accept any input
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on: 27726
  Show dependency tree
Reported: 2015-03-03 10:16 UTC by Alexander Köplinger
Modified: 2015-03-18 15:04 UTC (History)
6 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Alexander Köplinger 2015-03-03 10:16:03 UTC
Repro steps:

1. Open Mono command prompt
2. Enter "csharp"
3. The REPL starts, but doesn't accept any inputs, not even Ctrl+C. The mono process needs to be killed via Task manager.

Running csharp.exe on MS.NET works as expected.

Tested using official Mono 3.12 install on Windows 8.1, with Powershell/cmd/mingw-bash.

Interestingly, in cygwin-bash the csharp.exe fails with a DivideByZeroException:

>System.DivideByZeroException: Division by zero
>  at Mono.Terminal.LineEditor.UpdateHomeRow (Int32 screenpos) [0x00000] in C:\buildroot\release\repos\mono\mcs\tools\csharp\getline.cs:228
>  at Mono.Terminal.LineEditor.Render () [0x00091] in C:\buildroot\release\repos\mono\mcs\tools\csharp\getline.cs:223
>  at Mono.Terminal.LineEditor.InitText (System.String initial) [0x00023] in C:\buildroot\release\repos\mono\mcs\tools\csharp\getline.cs:811
>  at Mono.Terminal.LineEditor.Edit (System.String prompt, System.String initial) [0x0004a] in C:\buildroot\release\repos\mono\mcs\tools\csharp\getline.cs:841
>  at Mono.CSharpShell.GetLine (Boolean primary) [0x00037] in C:\buildroot\release\repos\mono\mcs\tools\csharp\repl.cs:245
>  at Mono.CSharpShell.ReadEvalPrintLoopWith (Mono.ReadLiner readline) [0x00007] in C:\buildroot\release\repos\mono\mcs\tools\csharp\repl.cs:338
>  at Mono.CSharpShell.ReadEvalPrintLoop () [0x0009e] in C:\buildroot\release\repos\mono\mcs\tools\csharp\repl.cs:370
>  at Mono.CSharpShell.Run (System.String[] startup_files) [0x00007] in C:\buildroot\release\repos\mono\mcs\tools\csharp\repl.cs:536
>  at Mono.Driver.Main (System.String[] args) [0x00180] in C:\buildroot\release\repos\mono\mcs\tools\csharp\repl.cs:90
Comment 1 Jo Shields 2015-03-04 11:56:01 UTC
I can reproduce the described behaviour.
Comment 2 Jo Shields 2015-03-06 05:05:09 UTC
OK, there seem to be two distinct failures.

Desktop Mono has three console drivers - "Null", "Windows" and "TermInfo".

The Windows driver is used in cmd/PowerShell. It's broken, I'm on it.

The Null driver is used in Cygwin - but it should be the TermInfo driver. I'm also on it (but the detection code is in the Mono runtime, not the classlib, so blurghhh)
Comment 3 Jo Shields 2015-03-10 13:33:11 UTC
The good news is I've isolated the bug which causes the cmd.exe breakage. The bad news is it's surprisingly deep in the runtime internals - 7968a8df1674a6e2aa8990faaca3c426efc2e279

This one is outside my ability to fix, I'll need to sweet-talk the runtime team
Comment 4 Vlad Brezae 2015-03-18 15:04:10 UTC

     Should be fixed by bba332f502aa974fc3e42ed83c4a77a4f806d6e8