PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework System.Diagnostics.Process TermWaiter.WaitForTerm();

Reply

System.Diagnostics.Process TermWaiter.WaitForTerm();

 
Thread Tools Rate Thread
Old 24-04-2008, 12:43 PM   #1
Rashmi C
Guest
 
Posts: n/a
Default System.Diagnostics.Process TermWaiter.WaitForTerm();


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?
  Reply With Quote
Old 27-04-2008, 09:06 PM   #2
Simon Hart [MVP]
Guest
 
Posts: n/a
Default RE: System.Diagnostics.Process TermWaiter.WaitForTerm();

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.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"Rashmi C" wrote:

> 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?

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off