Link to home
Start Free TrialLog in
Avatar of weirddemon
weirddemon

asked on

Process Class RedirectStandardError Crashing Application

This is going to be a strange issue and I don't expect an answer, but I would appreciate any insight.

I'm using Ghost32.exe to image HDDs within a Windows PE environment. With the release of WinPE 4.0, we can now use the 4.0 .NET framework. So in order to capture any errors that Ghost reports, I'm redirecting the standard error stream so I can review it later.

But, when I implement those two lines of code (highlighted below), the application crashes. I've implemented error logging with the UnhandledException event of the application, but it never fires during this error. All other errors fire, but this one does not.

So I ran it in normal Windows and I receive the following error:

The system cannot find the file specified

Dim p As New Process
        p.StartInfo.WorkingDirectory = "C:\Tools"
        p.StartInfo.FileName = "ghost32.exe"
        p.StartInfo.UseShellExecute = False
        p.StartInfo.RedirectStandardError = True
        p.Start()
        'Dim sr_err As StreamReader = p.StandardError
        p.WaitForExit()

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of weirddemon
weirddemon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial