For me, it is very misleading that BackgroundWorker.RunWorkerAsync uses the convention with suffix *Async but doesn't return a Task.
Please consider deprecating this method and come with a new methodname.
The same applies to CancelAsync
Fixing it would not be possible because it's a breaking change.
Or... deprecate BackgroundWorker completely and come with an (better) alternative.
For example one with async/await, cancellationtoken support etc. Would that be Task.Factory.StartNew or Task.Run?
deprecate BackgroundWorker completely and come with an (better) alternative.
For example one with async/await, cancellationtoken support etc. Would that beTask.Factory.StartNeworTask.Run?
According to Stephen Cleary, yes, Task.Run is the replacement for BackgroundWorker, see his series of blog posts where he compares the two.
Assuming the team agrees with that, I think it would make sense to make BackgroundWorker deprecated by adding it to the Platform Compatibility Analyzer.
Is [Deprecated] still used for a build-time notification, for those who may bypass the analyzer?
Most helpful comment
According to Stephen Cleary, yes,
Task.Runis the replacement forBackgroundWorker, see his series of blog posts where he compares the two.Assuming the team agrees with that, I think it would make sense to make
BackgroundWorkerdeprecated by adding it to the Platform Compatibility Analyzer.