Re: Monitoring Threads

Peter Ritchie <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <LISTSERV%[email protected]>
The completed and progress events are called on the same thread that calls
the RunWorkerAsync method.  If you call the RunWorkerAsync method on a
thread other than the GUI thread then you'll get cross-threading
exceptions when you try to access Control data from within those event
handlers.

Why are you calling RunWorkerAsync from a background thread?  I.e. what
are you trying to accomplish?  There's several ways to approach this, I'm
just trying to find out what way would be best.


On Wed, 28 Mar 2007 19:37:08 -0500, Kelly Baker
<[email protected]> wrote:

>I am still working on that dll that runs a process in a different thread,
>then raises a NewData event for the calling executable.  I have redone it
>using the BackgroundWorker class to do my threading.  I have a
>System.Timers.Timer object that runs the RunWorkerAsync method.  In the
>RunWorkerCompleted event I raise the NewData event.  But the executable
>still raises the cross-threading error when I try to update the form
>controls.  Is there a way to programmatically get the thread ID that is
>displayed on the Threads debug window?  I would like to log what thread is
>active with each operation until I can find where my problem is.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.