473,322 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Robustly detecting an error when starting an app via code

Hi everyone,

Can anyone tell me if there is a standard way of detecting an error in a
process that I've started using the .net framework's
System.Diagnostics.Process class?

I need to regularly call a secondary application but be able to tell if
a problem has occured with it and log the error (and then probably
restart it)

Can anyone tell me how to detect the error in the running process?

Thanks to anyone who can advise

Best regards

Simon
Sep 4 '07 #1
3 1437
Simon,

You can't do this in a generic manner. If anything, you have to have
knowledge of the process and how to retrieve any error that occurs in the
process. The only generic way of handling an error is to use the ExitCode
property on the Process class, but even then, the return values are specific
to the application being run.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Simon" <no******@hotmail.comwrote in message
news:Oc*************@TK2MSFTNGP06.phx.gbl...
Hi everyone,

Can anyone tell me if there is a standard way of detecting an error in a
process that I've started using the .net framework's
System.Diagnostics.Process class?

I need to regularly call a secondary application but be able to tell if a
problem has occured with it and log the error (and then probably restart
it)

Can anyone tell me how to detect the error in the running process?

Thanks to anyone who can advise

Best regards

Simon

Sep 4 '07 #2

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:OU*************@TK2MSFTNGP06.phx.gbl...
Simon,

You can't do this in a generic manner. If anything, you have to have
knowledge of the process and how to retrieve any error that occurs in the
process. The only generic way of handling an error is to use the ExitCode
property on the Process class, but even then, the return values are
specific to the application being run.
In addition to the exit code, you can capture output from a console
application, or some programs can be configured to write a log. Another
option might be to start the process under OS debug and capture
OutputDebugString calls (that's what .NET's TraceListener uses to send
messages by default).
>

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Simon" <no******@hotmail.comwrote in message
news:Oc*************@TK2MSFTNGP06.phx.gbl...
>Hi everyone,

Can anyone tell me if there is a standard way of detecting an error in a
process that I've started using the .net framework's
System.Diagnostics.Process class?

I need to regularly call a secondary application but be able to tell if a
problem has occured with it and log the error (and then probably restart
it)

Can anyone tell me how to detect the error in the running process?

Thanks to anyone who can advise

Best regards

Simon


Sep 5 '07 #3
Thanks guys - very much appreciated
Sep 8 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jole | last post by:
Hi I'm writing a program that needs to read from a file. In order for the program to be robust, it should somehow check that the file isn't corrupt, or stuffed in any way. For example, that...
1
by: Tim Gosselin | last post by:
I am writing a tcp tunnel but cannot find a way of detecting when a socket shuts down its read end without writing to the socket. For testing the write end of the remote endpoint I just do a: if...
8
by: Les Desser | last post by:
Is there any way to detect within A97 when Windows is trying to shut down, so I can close down the application gracefully? We currently have a trap in the main menu asking the user to confirm if...
7
by: Aarti | last post by:
I have written a windows service that needs to perform certain functions only if a User is logged in. The problem I am running into is that I get an error if the computer is in the process of being...
1
by: Sharkbait | last post by:
We are trying to record browser information when a customer comes to our site. I have been able to get most basic browser information using both asp and asp.net. The only thing I’m missing is the...
3
by: regtrashcan | last post by:
I have a webpage that detects whether Shockwave Player is installed and the version number. The javascript/vbscript that I use has worked fine until the latest release of the Shockwave Player. I am...
79
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the...
1
by: whitehorse | last post by:
When the warehousecontroller service is invoked, the following error message is sent to the application log: Event Type: Error Event Source: TFS Warehouse Event Category: None Event ID: 3000...
15
by: RobG | last post by:
When using createEvent, an eventType parameter must be provided as an argument. This can be one of those specified in DOM 2 or 3 Events, or it might be a proprietary eventType. My problem is...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.