Does it make any difference if you set ProcessStartInfo.UseShellExecute to false?
On Thu, 24 Apr 2008 10:23:23 -0500, Mike Andrews <[EMAIL PROTECTED]> wrote: >I'm having a particular problem that I need to resolve but can't seem to >find the answer. > >I have a Winform application that does various processes and spawns several >threads to do various bits of work. > >On one of the threads it spawns another thread that in turn uses the >Process.Start() method to start a new process (BCP in this case) to upload >some data to SQL Server. >Now... when I run this app from a console/command-line it works fine and no >process gets hung. When it's run from the winform app it hangs on the >Process.Start() method and doesn't return albeit the BCP executes and exits >normally. > >I've examined the threads and the thread is in a sleep, wait, or join state. > >Here's a partial list of the thread call stack: > >[In a sleep, wait, or join] >System.dll!System.Diagnostics.ShellExecuteHelper.ShellExecuteOnSTAThread () + >0x77 bytes >System.dll!System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo >startInfo) + 0x2d8 bytes >System.dll!System.Diagnostics.Process.Start() + 0x80 bytes >... > >I do have a Process.WaitForExit() method call after the Process.Start() call >but it never exits the Process.Start(). > >Here's my code that executes the process: > >Process p = new Process(); >p.StartInfo.FileName = "bcp.exe"; >p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; >p.StartInfo.Arguments = arguments.ToString(); >p.Start(); > =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com