process.WaitForExit() problem on framework 2.0 beta

  • Thread starter Thread starter Berni
  • Start date Start date
B

Berni

Hello

I have a programm that executes other processes. Everything was fine with
framework 1.1.

Now i have tested the assembly (still build with VS2003, framework 1.1) on
the framework 2.0 beta.

Unfortunatly in some cases, the method "process.WaitForExit()" waits
infinite. When the process exits, it does not affect the WaitForExit method.
If i replace the WaitForExit method with an interop call to kernel32.dll ->
WaitForSingleObject it works perfectly again.

Berni


[System.Runtime.InteropServices.DllImport("kernel32.dll")]
private static extern int WaitForSingleObject(IntPtr hHandle, uint
dwMilliseconds);
....

//this.process.WaitForExit();
WaitForSingleObject(this.process.Handle, 0xFFFFFFFF);
 
okay .. it was a little bit to eary for my post.
unfortunatly the "WaitForSingleObject" solution does not solve the problem.
The problem starts already when the process starts.

my code looks like this:
ProcessStartInfo processStartInfo=new ProcessStartInfo();
processStartInfo.FileName=executable;
processStartInfo.WorkingDirectory=workingDirectory;
this.process=Process.Start(processStartInfo);

The code hangs at the forth line (Process.Start). I see that the process is
started, but my programm does not continue to work at this point !

Please help,

Benri
 
Back
Top