My C# application after stepping through it is thrown a slew of process exceptions (from the base priority, exit code and exit time, handle, has exited, ID , machine name all the way down alphabetically until we get to working set 64).
From break pointing and stepping through the app the problem is centered around here.
[code]
string launchString = "";
string ReconCMDErrorMessage;
if (!Directory.Exists(launchPath))
{
Directory.CreateDirectory(launchPath);
}
if (launchPath != "") launchString = launchPath + "\\" + exeName;
else
{
launchString = exeName;
}
bool blnNoGood = false;
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(launchString);
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
psi.CreateNoWindow = true;
psi.WorkingDirectory = ConfigurationManager.AppSettings["Recon32Location"].ToString();
psi.UseShellExecute = false;
psi.Arguments = exeParameters;
System.Diagnostics.Process MyProcess = new System.Diagnostics.Process();
try
{
MyProcess.StartInfo = psi;
MyProcess.EnableRaisingEvents = true;
bool started = MyProcess.Start();
IntPtr myProcessHandle = MyProcess.Handle;
int myProcessID = MyProcess.Id;
MyProcess.Refresh();
//Loop until process has exited pausing 1 second in each loop.
//Additionally, we may need to keep track of the allowed number of attempts or allowed total wait time.
while (MyProcess.HasExited == false)
{
System.Threading.Thread.Sleep(1000);
MyProcess.Refresh();
}
if (MyProcess.HasExited == true)
{
int ProcessExitCode = MyProcess.ExitCode;
if ((ProcessExitCode != 0))
{
ReconCMDErrorMessage = LookupErrorCode(ProcessExitCode);
webpage.WebUIMessages.Add(new Status(ReconCMDErrorMessage));
}
}
System.Threading.Thread.Sleep(5000);
}
catch (Exception ex)
[\code]
Now earlier I placed this code in bold to pick up a directory a C drive where my batch files are stored and it succeeded. Now when the launch string is passed with the exe.name as the name of the bat file being passed then the exceptions I have notice fire off at the last line I bolded after stepping down to it in the execution run time and the while loop below that seeming goes on and on without breaking out of that area of the code. It never gets to the catch exception below.
Any ideas here ?
From break pointing and stepping through the app the problem is centered around here.
[code]
string launchString = "";
string ReconCMDErrorMessage;
if (!Directory.Exists(launchPath))
{
Directory.CreateDirectory(launchPath);
}
if (launchPath != "") launchString = launchPath + "\\" + exeName;
else
{
launchString = exeName;
}
bool blnNoGood = false;
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(launchString);
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
psi.CreateNoWindow = true;
psi.WorkingDirectory = ConfigurationManager.AppSettings["Recon32Location"].ToString();
psi.UseShellExecute = false;
psi.Arguments = exeParameters;
System.Diagnostics.Process MyProcess = new System.Diagnostics.Process();
try
{
MyProcess.StartInfo = psi;
MyProcess.EnableRaisingEvents = true;
bool started = MyProcess.Start();
IntPtr myProcessHandle = MyProcess.Handle;
int myProcessID = MyProcess.Id;
MyProcess.Refresh();
//Loop until process has exited pausing 1 second in each loop.
//Additionally, we may need to keep track of the allowed number of attempts or allowed total wait time.
while (MyProcess.HasExited == false)
{
System.Threading.Thread.Sleep(1000);
MyProcess.Refresh();
}
if (MyProcess.HasExited == true)
{
int ProcessExitCode = MyProcess.ExitCode;
if ((ProcessExitCode != 0))
{
ReconCMDErrorMessage = LookupErrorCode(ProcessExitCode);
webpage.WebUIMessages.Add(new Status(ReconCMDErrorMessage));
}
}
System.Threading.Thread.Sleep(5000);
}
catch (Exception ex)
[\code]
Now earlier I placed this code in bold to pick up a directory a C drive where my batch files are stored and it succeeded. Now when the launch string is passed with the exe.name as the name of the bat file being passed then the exceptions I have notice fire off at the last line I bolded after stepping down to it in the execution run time and the while loop below that seeming goes on and on without breaking out of that area of the code. It never gets to the catch exception below.
Any ideas here ?