Was just whipping up a quick util which immediately executes an assembly normally run by a winservice at night. The assembly implements an interface exposing a DoWork() function.

I decided to play with the BackgroundWorker component to keep my utils UI responsive and show a little animation while it chugs along. So I have a worker class which essentially implements the interface and calls DoWork().

I thought it would be cool to implement a cancel button while I was at it. BackgroundWorker supports a CancelAsync() which requires the worker thread to check backgroundWorker.CancellationPending and then return. But what if my worker is calling in to an assembly which is performing the long process?

Just curious if there is a way to forcing a BackgroundWorker to immediately cancel. A call to Dispose() was ignored and I didn't see a way to force the thread to exit immediately.