Bug 27597

Summary: csharp REPL on Windows doesn't accept any input
Product: [Mono] Runtime Reporter: Alexander Köplinger <alex.koeplinger>
Component: JITAssignee: Bugzilla <bugzilla>
Status: RESOLVED FIXED    
Severity: normal CC: jo.shields, mono-bugs+mono, mono-bugs+runtime, mono-bugs, vargaz, vlad.brezae
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Tags: Is this bug a regression?: ---
Last known good build:
Bug Depends on: 27726    
Bug Blocks:    

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
Hi,

     Should be fixed by bba332f502aa974fc3e42ed83c4a77a4f806d6e8

Vlad