System.Diagnostics.Process TermWaiter.WaitForTerm();

  • Thread starter Thread starter Rashmi C
  • Start date Start date
R

Rashmi C

We are using .Net CF 2.0.
We want to start the device clock application using Process.Start and when
the clock is closed/exitted, we want to carry out some operations. We have
used the following code for the same:

private void btnAdjustSystemTime_Click(object sender, EventArgs e)
{
System.Diagnostics.Process proc = new
System.Diagnostics.Process();
proc.StartInfo.FileName = "Clock.exe";
proc.EnableRaisingEvents = true;
proc.Exited += new EventHandler(clockProc_Exited);
proc.Start();
}

void clockProc_Exited(object sender, EventArgs e)
{
//do something here
}


Once, while executing the above code got a NullReferenceException with only
one line in the StackTrace:
TermWaiter.WaitForTerm();

After the exception, the application just shut down.

Could not recreate this exception.
Can anyone help me to find out the cause for the exception and its solution?
 
I don't know why you got a NullReferenceException calling that code as it
looks ok, but I'd wrap that code in a try catch and handle the error
correctly to make you're app more stable. This error probebly occured in the
clock.exe program.
 
Back
Top