Click to See Complete Forum and Search --> : System.Diagnostics.Process
eyalha
February 5th, 2008, 09:07 AM
Hi,
I have problem thats been driving me crazy lately,
I use the following code as a part of a larger application:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = sFileName;
proc.StartInfo.WorkingDirectory = sWorkingDirectory;
proc.Start();
its supposed to be activating an exe file.
On 90% of the computers I installed it on, it works perfectly.
on the other 10% nothing happens...I mean absolutly nothing...
no error message no exception, nothing (I tried pretty much any variation that can create an error should the proccess fails to start, but nothing...)
has anyone encountered such behaviour before?
zdavis
February 5th, 2008, 09:10 AM
That is a weird error. There are no errors being thrown or are you just not catching any errors that could possibly not stop runtime. My first thought is if you have permissions those 10% of machines to start and run a process.
DeepT
February 5th, 2008, 09:17 AM
How do you find out what sFileName is? Ill give you a clear example of how this can be messed up if it is hard coded.
I download your program twice and the 2nd version is MyApp[1].exe. Or perhaps, I just download it as something else.
eyalha
February 5th, 2008, 09:25 AM
That is a weird error. There are no errors being thrown or are you just not catching any errors that could possibly not stop runtime. My first thought is if you have permissions those 10% of machines to start and run a process.
I am trying to catch the errors using try-catch block but nothing is thrown,
actually I know that the Start() method actually returns True as if everything is ok (I tried chceking the return value from it).
My guess is also that this is some bizare permission issue, but I cant put my finger on it...I verified that thoese users have admin. priveleges on their computers, I tried checking proccess counters (just in case) but no good came out of it.
at this point any idea will be a good one...
ireland
February 5th, 2008, 11:04 AM
Have a look in the EventLog on the machines that fail.
start->control panel->Administrative Tools->Event Viewer.
Arjay
February 5th, 2008, 12:35 PM
Add a few Debug.WriteLine calls to your code to display the sFileName and sWorkingDirectory to the debug port.
Then copy a debug version of your application over to the machine that it's failing on.
Start up Debug View (http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx) on the machine and then run your program.
The debug spew will appear in the Debug View program.
DeepT
February 6th, 2008, 08:45 AM
If the error is thrown in another thread, your try-catch will not capture it. You need to put one in each thread if you want to catch exceptions that they throw.
zdavis
February 6th, 2008, 08:57 AM
can you actually start the process manually on those 10% of machines. Actually start the process without having to use code. If it doesn't start I would think it is something outside the bounds of your code and would most likely point to a permission error or something of the sort.
-zd
eyalha
February 14th, 2008, 01:13 AM
can you actually start the process manually on those 10% of machines. Actually start the process without having to use code. If it doesn't start I would think it is something outside the bounds of your code and would most likely point to a permission error or something of the sort.
-zd
yes, I can start the exe file manually on those PC's.
Arjay
February 14th, 2008, 11:02 AM
Try the debugging technique I suggested earlier.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.