[Mono-dev] BackgroundWorker.CancelAsync() behaves incorrectly?
Achille Fouilleul
achille.fouilleul at gambro.com
Thu Apr 24 05:46:45 EDT 2008
Jordan Callicoat wrote:
>
> I guess nobody is using BackgroundWorker in mono then?
>
I am. Anyway, this is not the only problem with it.
Please have a look at the code below:
http://anonsvn.mono-project.com/source/trunk/mcs/class/System/System.ComponentModel/BackgroundWorker.cs
In the CompleteWorker method, "this.async" is assigned to null _after_ this
statement:
async.PostOperationCompleted (callback, e);
Therefore, OnRunWorkerCompleted may be (always in my case) executed
_before_, and will see IsBusy as True whereas it should be False.
The test case below prints True on .NET and False on Mono.
Reversing the order of those two statements seems to fix the issue.
http://www.nabble.com/file/p16848603/bgw.cs bgw.cs
--
View this message in context: http://www.nabble.com/BackgroundWorker.CancelAsync%28%29-behaves-incorrectly--tp16216320p16848603.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list
mailing list