BeginInvoke calls disappears to God knows where

  • Thread starter Thread starter Kallis
  • Start date Start date
K

Kallis

Dear all
I have an thread updating the GUI thread using the BeginInvoke
mechanism. However, in one app where I use this mechanism, it works
fine but in another it does not. The code looks like:

public void OnDisplay(GUIEventArgs args)
{
object[] list = {args};
// We get here without problem. We are still in the other Thread
// Now switch to GUI Thread....
this.BeginInvoke(new SwitchToGUIThreadHandler(DoDisplay),list);
// .. but this call ends up in nirvana
}

private delegate void SwitchToGUIThreadHandler(GUIEventArgs args);
public void DoDisplay(GUIEventArgs args)
{
//Never gets here
}

I have no clue why it does not work in the other application and that
is my problem. I don't even have no clue how to start diagnose it.

Ideas anyone?

BR
Kallis
 
Well, I am sure so far that no breakpoints set in the DoDisplay()
function get reached. What did you have in mind? I mean, the most
frustrating about this problem is that the code works in one app bu
not in the other. I expect it to be a subtle issue.

Kallis


Miha Markic said:
Hi Kallis,

Are you sure that it doesn't get there?

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Kallis said:
Dear all
I have an thread updating the GUI thread using the BeginInvoke
mechanism. However, in one app where I use this mechanism, it works
fine but in another it does not. The code looks like:

public void OnDisplay(GUIEventArgs args)
{
object[] list = {args};
// We get here without problem. We are still in the other Thread
// Now switch to GUI Thread....
this.BeginInvoke(new SwitchToGUIThreadHandler(DoDisplay),list);
// .. but this call ends up in nirvana
}

private delegate void SwitchToGUIThreadHandler(GUIEventArgs args);
public void DoDisplay(GUIEventArgs args)
{
//Never gets here
}

I have no clue why it does not work in the other application and that
is my problem. I don't even have no clue how to start diagnose it.

Ideas anyone?

BR
Kallis
 
No I didn't. But that's an intressting point. Where should a put those
to calls, according to you? After the BeginInvoke line?
BR
Kallis


Nick Harris said:
Have you tried clearing pending event msgs using Application.DoEvents and
then refreshing the form?

Nick Harris, MCSD
http://www.VizSoft.net

Kallis said:
Dear all
I have an thread updating the GUI thread using the BeginInvoke
mechanism. However, in one app where I use this mechanism, it works
fine but in another it does not. The code looks like:

public void OnDisplay(GUIEventArgs args)
{
object[] list = {args};
// We get here without problem. We are still in the other Thread
// Now switch to GUI Thread....
this.BeginInvoke(new SwitchToGUIThreadHandler(DoDisplay),list);
// .. but this call ends up in nirvana
}

private delegate void SwitchToGUIThreadHandler(GUIEventArgs args);
public void DoDisplay(GUIEventArgs args)
{
//Never gets here
}

I have no clue why it does not work in the other application and that
is my problem. I don't even have no clue how to start diagnose it.

Ideas anyone?

BR
Kallis
 
Can you create a sample?

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Kallis said:
Well, I am sure so far that no breakpoints set in the DoDisplay()
function get reached. What did you have in mind? I mean, the most
frustrating about this problem is that the code works in one app bu
not in the other. I expect it to be a subtle issue.

Kallis


"Miha Markic" <miha at rthand com> wrote in message
Hi Kallis,

Are you sure that it doesn't get there?

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Kallis said:
Dear all
I have an thread updating the GUI thread using the BeginInvoke
mechanism. However, in one app where I use this mechanism, it works
fine but in another it does not. The code looks like:

public void OnDisplay(GUIEventArgs args)
{
object[] list = {args};
// We get here without problem. We are still in the other Thread
// Now switch to GUI Thread....
this.BeginInvoke(new SwitchToGUIThreadHandler(DoDisplay),list);
// .. but this call ends up in nirvana
}

private delegate void SwitchToGUIThreadHandler(GUIEventArgs args);
public void DoDisplay(GUIEventArgs args)
{
//Never gets here
}

I have no clue why it does not work in the other application and that
is my problem. I don't even have no clue how to start diagnose it.

Ideas anyone?

BR
Kallis
 
Back
Top