Re: BackgroundWorker problems
"Nassar, Anthony" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <[email protected]> |
I call ShowDialog() from the background thread on which the dialog was created, so that's not the problem. Show() was a problem, but we don't know why. If we were making an illegal call, we'd get an exception (at least in .NET 2.0; I don't remember what used to happen), but it really seems like something is blocking somewhere. I'm not sure what needs to be TDDed here anyway. We don't need to verify that BackgroundWorker works correctly. On Yahoo!'s TDD newsgroup, this question comes up often, and I can summarize by saying that you very rarely want to test the interaction of code on different threads. You really want to test their different tasks separately. Well, if Ron's background task does nothing but call ReportProgress(), there's really nothing to test in the first place. ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Sean Dockery Sent: Friday, November 16, 2007 11:24 AM To: [email protected] Subject: Re: [Nunit-users] BackgroundWorker problems Quick question from someone new to .NET: Aren't you forbidden from calling into the GUI from a thread other than the GUI event processing thread? If that is the case, shouldn't you be looking to doing all of your GUI-related code by posting windows messages (or some similar vehicle equivalent to what you did in the WIN32 days) to the main GUI event processing thread? There are probably a number of alternative approaches to doing this, such as having your BackgroundWorker thread's delegate report progress and completion status through non-GUI properties that are read by a Timer component in the form, for example. Am I way off in suggesting this type of approach? Kindest regards, ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Nassar, Anthony Sent: November 16, 2007 7:53 AM To: Ian Wood; Lisle, Ron; [email protected] Subject: Re: [Nunit-users] BackgroundWorker problems Check out the code I just posted: I had to create the form on a separate thread, and call ShowDialog(). Even so, neither the form nor the BackgroundWorker is ever disposed! I can't figure it out. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Nunit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nunit-users