[Mono-bugs] [Bug 394365] New: Incorrect BackgroundWorker.IsBusy return value

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun May 25 13:17:58 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=394365


           Summary: Incorrect BackgroundWorker.IsBusy return value
           Product: Mono: Class Libraries
           Version: SVN
          Platform: i386
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: achille.fouilleul at gadz.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


According to
http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.isbusy.aspx

IsBusy should return "true, if the BackgroundWorker is running an asynchronous
operation; otherwise, false."

In the Mono implementation available at
http://anonsvn.mono-project.com/source/trunk/mcs/class/System/System.ComponentModel/BackgroundWorker.cs
the value returned by depends on whether the async instance variable is null or
not.

However, in two places, async is set to null only after the RunWorkerCompleted
event handler is executed (lines 86 and 149). Consequently, the event handler
"sees" IsBusy as true when it should be false. This behavior is not consistent
with MS's .NET implementation.

The included test case (bgw.cs) exposes the problem; it prints "True" when it
should print "False".

A possible solution would be to move the two "this.async = null;" statements
before the corresponding calls to OnRunWorkerCompleted. This seems to fix the
problem.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list