Bug 12971 - Console.Is*Redirected returns true if Set*() has been called; different from .NET
Summary: Console.Is*Redirected returns true if Set*() has been called; different from ...
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 2.10.x
Hardware: PC All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-06-30 17:19 UTC by Greg Najda
Modified: 2013-07-18 02:59 UTC (History)
2 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 Greg Najda 2013-06-30 17:19:04 UTC
Run the following program. On .NET the output is

C:\Users\Greg\Documents\Visual Studio 2012\Projects\IsRedirectedTest\IsRedirectedTest\bin\Debug>IsRedirectedTest.exe
Error is redirected: False

On Mono:

C:\Users\Greg\Documents\Visual Studio 2012\Projects\IsRedirectedTest\IsRedirectedTest\bin\Debug>"C:\Program Files (x86)\Mono-3.0.10\bin\mono.exe" IsRedirectedTest.exe
Error is redirected: True

using System;
using System.IO;

namespace IsRedirectedTest
    class Program
        static void Main(string[] args)
            Console.WriteLine("Error is redirected: {0}", Console.IsErrorRedirected);

The documentation on MSDN (http://msdn.microsoft.com/en-us/library/system.console.iserrorredirected.aspx) is not clear what the behavior is supposed to be but this test demonstrates that the actual behavior on .NET is to not be affected by SetIn, SetOut, and SetError.
Comment 1 Marek Safar 2013-07-18 02:59:40 UTC
Fixed in master