[Mono-bugs] [Bug 431814] New: Message in IOE should be improved

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 2 22:04:02 EDT 2008


           Summary: Message in IOE should be improved
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: aaragoneses at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Given this program:

using System;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;

namespace Test
        class MainClass
                public static void Main(string[] args)
                        if (args.Length == 0) {
                                if (System.Environment.OSVersion.Platform ==
                                        Father (true);
                                        Father (false);
                        else {
                                Child ();

                public static void Father (bool runningOnMono) {
                        Console.WriteLine ("I am the father");
                        string myPath = Path.Combine
(AppDomain.CurrentDomain.BaseDirectory, typeof (MainClass).Assembly.GetName
().Name + ".exe");

                        Process p = new Process ();

                        p.StartInfo.WorkingDirectory =
                        if (runningOnMono) {
                                p.StartInfo.FileName = "mono";
                                p.StartInfo.Arguments = myPath + " child";
                        else {
                                p.StartInfo.FileName = myPath;
                                p.StartInfo.Arguments = "child";
                        p.StartInfo.UseShellExecute = false;
                        p.StartInfo.CreateNoWindow = true;
                        p.StartInfo.RedirectStandardOutput = true;
                        p.StartInfo.RedirectStandardError = true;
                        p.EnableRaisingEvents = true;
                        p.Start ();
                        Console.WriteLine ("main thread is going to sleep");
                        System.Threading.Thread.Sleep (10000);
                        p.Close ();
                        Console.WriteLine (p.StandardOutput.ReadToEnd ());
                        Console.WriteLine ("this program ends");


                static void OnDataReceived (object sender,
DataReceivedEventArgs args)
                        Console.WriteLine ("data received from the child");

                public static void Child () {
                        while (true){
                                Console.WriteLine ("this is a line");
                                System.Threading.Thread.Sleep (1000);

Mono returns:
Unhandled Exception: System.InvalidOperationException: Standard output has not
been redirected

MS.NET returns:
Unhandled Exception: System.InvalidOperationException: StandardOut has not been
redirected or the process hasn't started yet.

But we should return even a better one than both:
Unhandled Exception: System.InvalidOperationException: Standard output has not
been redirected, or else the process hasn't started yet or finished already.

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