Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / September 2007

Tip: Looking for answers? Try searching our database.

Robustly detecting an error when starting an app via code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Simon - 04 Sep 2007 20:26 GMT
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
Nicholas Paldino [.NET/C# MVP] - 04 Sep 2007 20:41 GMT
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.

Signature

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

> Hi everyone,
>
[quoted text clipped - 13 lines]
>
> Simon
Ben Voigt [C++ MVP] - 05 Sep 2007 00:55 GMT
> Simon,
>
[quoted text clipped - 3 lines]
> 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).

>> Hi everyone,
>>
[quoted text clipped - 13 lines]
>>
>> Simon
Simon - 08 Sep 2007 18:01 GMT
Thanks guys - very much appreciated

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.