[Mono-bugs] [Bug 645193] New: BinaryWriter on Console standard output no longer works correctly
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sat Oct 9 05:46:28 EDT 2010
https://bugzilla.novell.com/show_bug.cgi?id=645193
https://bugzilla.novell.com/show_bug.cgi?id=645193#c0
Summary: BinaryWriter on Console standard output no longer
works correctly
Classification: Mono
Product: Mono: Class Libraries
Version: 2.8.x
Platform: x86
OS/Version: Windows 7
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: joe at mistachkin.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.10)
Gecko/20100914 Firefox/3.6.10
There seems to be an issue with using BinaryWriter and the Console together;
however, it may just be a problem with BinaryWriter. Output appears to be
"lost" unless Flush is used. This worked perfectly with Mono 2.6.7 and it
works with the .NET Framework. Small writes seem to be the most troublesome.
Reproducible: Always
Steps to Reproduce:
1. Compile and run the following program.
2. Type some short strings into the program and they should be displayed
verbatim back to you.
3. Observe that newline characters and possibly other output is missing.
using System;
using System.IO;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Stream stream = Console.OpenStandardOutput();
BinaryWriter writer = new BinaryWriter(stream, Encoding.ASCII);
int count = 100;
while (count-- > 0)
{
//
// NOTE: For maximum fun, try typing short strings like
// "hi" or "foo".
//
string line = Console.ReadLine();
//
// NOTE: Yes, this is a slightly odd way of doing this.
// However, it worked in Mono 2.6.7 and it works
// in the .NET Framework.
//
writer.Write(Encoding.ASCII.GetBytes(line));
writer.Write(Encoding.ASCII.GetBytes(Environment.NewLine));
//
// NOTE: This "fixes" the issue; however, it should not
// be required.
//
// writer.Flush();
}
}
}
}
Actual Results:
1. Missing newline characters.
2. Output does not display correctly on the screen (this is probably due to
some internal buffer not being flushed).
Expected Results:
Each line entered should be displayed verbatim, including the newline
character.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list