Has the ShowDialog -> Invoke bug been fixed yet?

  • Thread starter Thread starter tcarvin
  • Start date Start date
T

tcarvin

I ran into a bug a while back in the Compact Framework trying to
"Invoke" on a modal form from a worker thread. The Docs said
"Invoke" would marshal the call onto the UI thread, but it didn't.
Has this been fixed? I came up with nice self-contained work around
but if this has been fixed I'd prefer to do it the "right" way.
Also, if it hasn't been fixed I can post my solution if it would
anyone out.

Tom
 
This is fixed in Service Pack 1. SP1 is available for download on the
Microsoft site.

David Wrighton
.NET Compact Framework

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: (e-mail address removed) (tcarvin)
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Has the ShowDialog -> Invoke bug been fixed yet?
| Date: 21 Aug 2003 05:48:06 -0700
| Organization: http://groups.google.com/
| Lines: 9
| Message-ID: <[email protected]>
| NNTP-Posting-Host: 66.152.245.14
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1061470086 30156 127.0.0.1 (21 Aug 2003
12:48:06 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: 21 Aug 2003 12:48:06 GMT
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-
xit-09!supernews.com!postnews1.google.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:31572
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| I ran into a bug a while back in the Compact Framework trying to
| "Invoke" on a modal form from a worker thread. The Docs said
| "Invoke" would marshal the call onto the UI thread, but it didn't.
| Has this been fixed? I came up with nice self-contained work around
| but if this has been fixed I'd prefer to do it the "right" way.
| Also, if it hasn't been fixed I can post my solution if it would
| anyone out.
|
| Tom
|
 
Hi,
I've a similar problem with the following code:

private void synchronizer_Progress(object sender, SyncProgressEventArgs e) {
statusText = e.Info;
try {
Invoke(new SetStatusDelegate(SetStatus));
}
catch (Exception ex) {
MessageBox.Show("Error: " + ex.Message);
}
}
private string statusText;
private void SetStatus() {
lblStatus.Text = statusText;
}
private delegate void SetStatusDelegate();

The code resides in a Form shown with ShowDialog(), the
synchronizer_Progress is called from a threadpool worker delegate (i.e. not
the GUI thread).
The problem is that the call to Invoke throws a ArgumentException without
any more info. Is this the Invoke bug? I've installed the SP1 on the PPC and
replaced all SP1 dev cabs to the VS.NET 2003 folders with the new ones.

/Marcus
 
Hi again,
found a sample on MSDN for how to use Invoke on Compact .NET. The solution
was simple ... use EventHandler instead of your own delegate ... now it
works with Control.Invoke, FINALLY ;)

/Marcus
 
Yes, I was using the Invoke with an EventHandler. While kind of annoying,
that wasn't really the problem I was having. My problem was that when the
Invoke was called from the worker thread into a Modal form (one shown with
the ShowDialog method), it didn't execute until the form was dismissed. I
thought I read on one of the NGs that the CF SP1 only fixes the runtimes but
doesn't fix the emulator. Is that true?

Thanks,
Tom
 
Yes, it's true. I had the same problem and SP1 solved it.
(At least the runtime, the emulator I haven't tried.)
Tibor
 
Back
Top