[Mono-bugs] [Bug 80019][Nor] Changed - Process.BeginOutputReadline() causes exception

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Nov 23 14:10:15 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mgolisch at tuxhost.de.

http://bugzilla.ximian.com/show_bug.cgi?id=80019

--- shadow/80019	2006-11-23 10:08:19.000000000 -0500
+++ shadow/80019.tmp.777	2006-11-23 14:10:15.000000000 -0500
@@ -46,6 +46,54 @@
 ProcessStartInfo object and register the eventhandler bevore i call
 proc.Start() it seems to work well.
 
 ------- Additional Comments From dick at ximian.com  2006-11-23 10:08 -------
 Please attach a complete, compilable, self-contained test case that
 demonstrates this bug.
+
+------- Additional Comments From mgolisch at tuxhost.de  2006-11-23 14:10 -------
+--test.cs--
+
+using System;
+using System.Text;
+using System.Diagnostics;
+using System.Threading;
+
+namespace process
+{
+    class Program
+    {
+        static Process proc;
+        static AutoResetEvent signal;
+
+        static void Main(string[] args)
+        {
+            signal = new AutoResetEvent(false);
+            ProcessStartInfo psi = new ProcessStartInfo();
+            psi.FileName = "find";
+            psi.Arguments = "/ test";
+            psi.UseShellExecute = false;
+            psi.RedirectStandardOutput = true;
+            proc = Process.Start(psi);
+            proc.OutputDataReceived += new
+DataReceivedEventHandler(get_output);
+            proc.BeginOutputReadLine();
+            while (true)
+                signal.WaitOne();
+        }
+
+        static void get_output(object sender, DataReceivedEventArgs e) 
+        {
+            Console.WriteLine("Line: "+e.Data);
+            signal.Set();
+        }
+    }
+}
+
+as said before it works when not using the static Process.Start() and
+a ProcessStartInfo object.
+i have tested the same code (of course using another cmdline program)
+on windows using .net 2.0 and it worked there.
+
+thx in advance
+
+Michael Golisch


More information about the mono-bugs mailing list