I have a question regarding the RunWorkerCompleted() event of a Background Worker. I have coded the events up and have set the Background Workers as reporting progress and supporting cancellation. Throughout the processing I check for CancellationPending and take the necessary actions (I believe), but on cancellation and the calling of the CancelAsync() the RunWorkerCompleted event gets fired and I was expecting to be able to test e.Cancelled to see if the completion was because of a cancellation request.
This property never seems to get set - the RunWorkerCompleted() event gets called as soon as I click the cancel button, but the property is not set meaning that the cleanup/display code I have in the event does not get fired.
I must have missed something .... any suggestions would be greatly appreciated as I just cannot see the issue.