List Info

Thread: Re: Problem with System.Diagnostics.Process.Start() - acts as if it's blocking th




Re: Problem with System.Diagnostics.Process.Start() - acts as if it's blocking th
country flaguser name
United States
2008-04-24 10:35:48
Does it make any difference if you set
ProcessStartInfo.UseShellExecute to
false?

On Thu, 24 Apr 2008 10:23:23 -0500, Mike Andrews
<outdoor.jellyrollGMAIL.COM> 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.ShellEx
ecuteOnSTAThread
() +
>0x77 bytes
>System.dll!System.Diagnostics.Process.StartWithShellExec
uteEx
(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


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )