Re: BackgroundWorker problems
"Charlie Poole" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <009901c82630$9d5cf5e0$6401a8c0@FERRARI> |
Hi Anthony, I think I've figured out the problem. NUnit has no reason to keep your fixture class around once it's executed the small number of unit tests in it, right? So the entire AppDomain is unloaded, and therefore the form, and the BackgroundWorker component on it, get killed. The form's OnDisposed and OnClosing methods never even get called; likewise the completion callback. CP: It depends on whether he is running the nunit gui or the console runner. The gui will never unload an AppDomain unless it needs to reload or if you use a menu item to tell it to do so. The console runner, of course, exits when it is done so the appdmains are all unloaded. In either case, however, the fixture object is subject to garbage collection after it's tests have run to completion. I don't think you can do what you're trying to do here, though I'm not sure exactly what you're trying to do. You're basically hoping that the background task will complete before the appropriate test is called. Unless you synchronize the thread on which the tests are running and the background thread onto which the task is put, that's not gonna happen. When I built delays in, the AppDomain still got unloaded by the test runner (I'm using ReSharper, but it doesn't matter). CP: Actually, since resharper's runner doesn't really use NUnit (they have there own code) it could matter a lot. Charlie ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Nunit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nunit-users